OpenForm WhereCondition=Variable

G

Guest

Can someone tell me how to open a form to show only records defined by a
variable? My code works if I type a literal number in but I can't figure out
how do it with a variable:
Dim stDocName As String
Dim stLinkCriteria As String
Dim MyVariable As Long

txtECRNumber.SetFocus
MyVariable = txtECRNumber.Text
stDocName = "subfECRTasks"

DoCmd.OpenForm stDocName, , , "ECRNumber = MyVariable"
 

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