Missing Operator

B

BMBerna

I am trying to create relationship between two forms. I have a button
which is suppose to look in a text box called "clients name" and bring
up information on another form which should match the clients name
with in textbox of "Parent of" on the other form. This is what I have
so far but it does not work.

Private Sub Command11_Click()
On Error GoTo Err_Command11_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Parent"

stLinkCriteria = "[Parent Of]=" & Me![Client's Name]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command11_Click:
Exit Sub

The button gives me syntax error/ missing operator. Although, if i can
get it partially to work, I get a pop-up asking for clients name.
What am i doing wrong?
 
F

fredg

I am trying to create relationship between two forms. I have a button
which is suppose to look in a text box called "clients name" and bring
up information on another form which should match the clients name
with in textbox of "Parent of" on the other form. This is what I have
so far but it does not work.

Private Sub Command11_Click()
On Error GoTo Err_Command11_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Parent"

stLinkCriteria = "[Parent Of]=" & Me![Client's Name]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command11_Click:
Exit Sub

The button gives me syntax error/ missing operator. Although, if i can
get it partially to work, I get a pop-up asking for clients name.
What am i doing wrong?

You write:
match the clients name with in textbox of "Parent of" on the other form. <

You need to match the value in a field in the ** table ** that is
displayed in the control [Parent Of] on the second form.
Do you actually have a field in your table named "Parent Of"?
What is the datatype of the [Parent Of] field?
I would assume it's text (not Number).
If so, then:

stLinkCriteria = "[Parent Of]=""" & Me![Client's Name] & """"

In VBA help files, look up

Restrict data to a subset of records

form more information about the proper syntax to use for the various
datatypes.
 
B

BMBerna

 I am trying to create relationship between two forms. I have a button
which is suppose to look in a text box called "clientsname" and bring
up information on another form which should match the clientsname
with in textbox of "Parent of" on the other form. This is what I have
so far but it does not work.
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Parent"
    stLinkCriteria = "[Parent Of]=" & Me![Client'sName]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command11_Click:
    Exit Sub
The button gives me syntax error/ missing operator. Although, if i can
get it partially to work, I get a pop-up asking for clientsname.
What am i doing wrong?

You write:
match the clientsnamewith in textbox of "Parent of" on the other form. <

You need to match the value in a field in the ** table ** that is
displayed in the control [Parent Of] on the second form.
Do you actually have a field in your table named "Parent Of"?
What is the datatype of the [Parent Of] field?
I would assume it's text (not Number).
If so, then:

stLinkCriteria = "[Parent Of]=""" & Me![Client'sName] & """"

In VBA help files, look up

Restrict data to a subset of records

form more information about the proper syntax to use for the various
datatypes.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -

- Show quoted text -

Yes I do have a field in my table that is called Parent Of . it is a
text box on the form and in table.
I will try the code above and check VBA help files.
Thanks
 

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