Opening a form

G

Guest

Hi,
I'm trying to open a form from another form in Access2K as follows:-
DoCmd.OpenForm "frm_BlockReservationLast", acNormal, , "[BedID] = " &
Forms!frm_MKBlockReservation!BedID

I'm getting the error message "Syntax Error (missing operator) in query
expression
'BedID]=306A'. BedID is a string, what am I missing here?
 
R

Rick Brandt

TS said:
Hi,
I'm trying to open a form from another form in Access2K as follows:-
DoCmd.OpenForm "frm_BlockReservationLast", acNormal, , "[BedID] = " &
Forms!frm_MKBlockReservation!BedID

I'm getting the error message "Syntax Error (missing operator) in
query expression
'BedID]=306A'. BedID is a string, what am I missing here?

Quotes.

DoCmd.OpenForm "frm_BlockReservationLast", acNormal, , "[BedID] = ' " &
Forms!frm_MKBlockReservation!BedID & " ' "

I put spaces between the single and double quotes for clarity in this post.
You would not include those in your actual code.
 
V

Van T. Dinh

You need to use the String delimiter for the wherecondition. Try:

DoCmd.OpenForm "frm_BlockReservationLast", acNormal, ,
"[BedID] = '" & Forms!frm_MKBlockReservation!BedID & "'"

Just after [BedID] = : Single Quote + Double Quote
and at the end: Double Quote + Single Quote + Double Quote
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top