Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WhereCondition syntax

Status
Not open for further replies.

pcdave41

MIS
Sep 13, 2004
3
US
i'm trying to open a form using information from 2 already populated fields using the following code. I'm not sure how to format the WhereCondition to accomidate two fields. Any help would be great.

Private Sub Details_Click()

Dim stFrmName As String
Dim stCond1 As String
Dim stCond2 As String

stFrmName = "frmMainView"
stCond1 = "[TRANSID]=" & Me!TRANSID
stCond2 = "[REGION]=" & Me!REGION

DoCmd.OpenForm FormName:=stFrmName, WhereCondition:=stCond1 and stCond2

Forms!frmMainView.SetFocus
End Sub
 
The WhereCondition is the same as a where condition in an sql statement, without the keyword Where, so:

[tt]stCond1 & " and " & stCond2[/tt]

should probably work

Roy-Vidar
 
Roy,

That did the trick.. I appreciate the help.

Regards,
Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top