Syntax Error

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 & "'"
 
J

Jennifer H.

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.
 
G

Guest

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 & "'"
.
.
 
J

Jennifer H

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 & "'"
.
.
.
 
B

Bill

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 & "'"
.

.
.
.
 

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

Similar Threads

Code Problem 8
Record Selection 3
I have a problem with opening a form. 11
Error 2501 !!! 5
acNormal 1
VBA Check for printer 2
SQL VBA -- INNER JOIN Syntax 6
Cant edit Access 2003 form 3

Top