|
 |
access thread: where condition on two fields
Message #1 by "Rogers, Robert" <rrogers@b...> on Tue, 25 Sep 2001 12:34:16 -0400
|
|
I would like to filter on more than one field here is my code behind my
button.
Dim stDocName As String
Dim stlinkcriteria As String
stDocName = "frmFullRecord"
stlinkcriteria = "[CUSNBR]=" & Me![CUSNBR] 'I would like to filter on
two fields.
DoCmd.OpenForm stDocName, , , stlinkcriteria
Robert L. Rogers
Rexel Branch Electric
Application Developer
Message #2 by "John Ruff" <papparuff@c...> on Tue, 25 Sep 2001 10:36:01 -0700
|
|
Try this,
If the second field is a text field then,
stlinkcriteria = "[CUSNBR]=" & Me![CUSNBR] & " AND
[NextField]='" txtSecondField & "'"
If the second field is a numberic field then,
stlinkcriteria = "[CUSNBR]=" & Me![CUSNBR] & " AND
[NextField]=" dblNumber
John Ruff - The Eternal Optimist :-)
-----Original Message-----
From: Rogers, Robert [mailto:rrogers@b...]
Sent: Tuesday, September 25, 2001 9:34 AM
To: Access
Subject: [access] where condition on two fields
I would like to filter on more than one field here is my code behind my
button.
Dim stDocName As String
Dim stlinkcriteria As String
stDocName = "frmFullRecord"
stlinkcriteria = "[CUSNBR]=" & Me![CUSNBR] 'I would like to filter
on
two fields.
DoCmd.OpenForm stDocName, , , stlinkcriteria
Robert L. Rogers
Rexel Branch Electric
Application Developer
Message #3 by "Rogers, Robert" <rrogers@b...> on Tue, 25 Sep 2001 14:03:20 -0400
|
|
thanks for the help John. The AND was the key.
stlinkcriteria = "[CUSNBR]=" & Me![CUSNBR] & " and [CUSSUF]=" & Me![CUSSUF]
DoCmd.OpenForm stDocName, , , stlinkcriteria
-----Original Message-----
From: John Ruff [mailto:papparuff@c...]
Sent: Tuesday, September 25, 2001 1:36 PM
To: Access
Subject: [access] RE: where condition on two fields
Try this,
If the second field is a text field then,
stlinkcriteria = "[CUSNBR]=" & Me![CUSNBR] & " AND
[NextField]='" txtSecondField & "'"
If the second field is a numberic field then,
stlinkcriteria = "[CUSNBR]=" & Me![CUSNBR] & " AND
[NextField]=" dblNumber
John Ruff - The Eternal Optimist :-)
-----Original Message-----
From: Rogers, Robert [mailto:rrogers@b...]
Sent: Tuesday, September 25, 2001 9:34 AM
To: Access
Subject: [access] where condition on two fields
I would like to filter on more than one field here is my code behind my
button.
Dim stDocName As String
Dim stlinkcriteria As String
stDocName = "frmFullRecord"
stlinkcriteria = "[CUSNBR]=" & Me![CUSNBR] 'I would like to filter
on
two fields.
DoCmd.OpenForm stDocName, , , stlinkcriteria
Robert L. Rogers
Rexel Branch Electric
Application Developer
|
|
 |