Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Form From Subform

Status
Not open for further replies.
May 5, 2002
79
US
I have a continous subform. On the subform I have a command button with the following code. It fails. Obviously I am missing something.

'DoCmd.OpenForm "frmRooms", , , "[RecID] = '" & Me.RoomID & "'"

frmRooms is a form to open, RecID is the frmRooms field to search on and Me.RoomID is my combobox on the the subform.

Any help woulld be greatly appreciated.
 
I assume the statement is NOt commented out in the real application?

What error message do you get?
 
Yes in the code its not commented out. The error displayed is Error 2501 Open Form Action Cancelled.
 
Hi!

The 2501 means the form opening is cancelled. One reason for that, might be that the id is numeric and not text, if so, try:

[tt]DoCmd.OpenForm "frmRooms", , , "[RecID] = " & Me.RoomID[/tt]

Else, see if there's any code in th frmRooms cancelling the opening.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top