stLinkCriteria

M

Melissa

Hey all!

I wish to open a form from a form where two fields are
the same, e.g. invoice number, work category.

Linking by one field I know how to do. But I need more
selection. How do I adjust the following code to test for
two fields? (inum and wcat) ?

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmWrkSum"
stLinkCriteria = "[inum]=" & Me![inum]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Thanking you in advance...
Melissa
 
J

Jim Allensworth

It's a WHERE clause without the WHERE. So just and the 2 expressions.
stLinkCriteria = "inum=" & Me.inum & " AND wcat=" & Me.wcat

If wcat is a string then wrap the value in single quotes...
stLinkCriteria = "inum=" & Me.inum & " AND wcat='" & Me.wcat & "'"

- Jim
 
M

Melissa

Thankyou soooooooooo much, Jim. That solved current
dilemma and taught me something new.

Thanks, Melissa

-----Original Message-----
It's a WHERE clause without the WHERE. So just and the 2 expressions.
stLinkCriteria = "inum=" & Me.inum & " AND wcat=" & Me.wcat

If wcat is a string then wrap the value in single quotes...
stLinkCriteria = "inum=" & Me.inum & " AND wcat='" & Me.wcat & "'"

- Jim

Hey all!

I wish to open a form from a form where two fields are
the same, e.g. invoice number, work category.

Linking by one field I know how to do. But I need more
selection. How do I adjust the following code to test for
two fields? (inum and wcat) ?

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmWrkSum"
stLinkCriteria = "[inum]=" & Me![inum]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Thanking you in advance...
Melissa

.
 

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