Opening a form

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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.
 
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
 
Back
Top