Syntax Error

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

The code below is causing a syntax error when executed
from a command button. Anyone know why?

DoCmd.OpenForm "frmStudyData", acNormal, , "Study Number
= '" & Forms!frmUpdate1!txtUpdate1 & "'"
 
Assuming that "Study Number" is the name of a field, you
need to enclose it in square brackets because of the
space. So it should look like this: [Study Number].

Jennifer H.
 
Thanks Jennifer, that got rid of the error message, but
the form does not open to the record requested, it opens
to a new record. I did check, and the record requested
is in the table
-----Original Message-----
Assuming that "Study Number" is the name of a field, you
need to enclose it in square brackets because of the
space. So it should look like this: [Study Number].

Jennifer H.
-----Original Message-----
The code below is causing a syntax error when executed
from a command button. Anyone know why?

DoCmd.OpenForm "frmStudyData", acNormal, , "Study Number
= '" & Forms!frmUpdate1!txtUpdate1 & "'"
.
.
 
Is "Study Name" a field on the form you are trying to
open? And do you have any code in the Open event that
may be overriding this?
-----Original Message-----
Thanks Jennifer, that got rid of the error message, but
the form does not open to the record requested, it opens
to a new record. I did check, and the record requested
is in the table
-----Original Message-----
Assuming that "Study Number" is the name of a field, you
need to enclose it in square brackets because of the
space. So it should look like this: [Study Number].

Jennifer H.
-----Original Message-----
The code below is causing a syntax error when executed
from a command button. Anyone know why?

DoCmd.OpenForm "frmStudyData", acNormal, , "Study Number
= '" & Forms!frmUpdate1!txtUpdate1 & "'"
.
.
.
 
Study Name is the name of the field in the table
StartUp. txtUpdate1 is the name of a text box on the
form that is requesting the information from the user. I
want the table StartUp to open to the record that has the
matching data in field Study name as was entered in the
unbound text box txtUpdate1. there is no code in the
Open event
-----Original Message-----
Is "Study Name" a field on the form you are trying to
open? And do you have any code in the Open event that
may be overriding this?
-----Original Message-----
Thanks Jennifer, that got rid of the error message, but
the form does not open to the record requested, it opens
to a new record. I did check, and the record requested
is in the table
-----Original Message-----
Assuming that "Study Number" is the name of a field, you
need to enclose it in square brackets because of the
space. So it should look like this: [Study Number].

Jennifer H.

-----Original Message-----
The code below is causing a syntax error when executed
from a command button. Anyone know why?

DoCmd.OpenForm "frmStudyData", acNormal, , "Study Number
= '" & Forms!frmUpdate1!txtUpdate1 & "'"
.

.
.
.
 
Back
Top