sending parameters from one form to a query based form

M

MeganF

I am trying to send 2 parameters from a form in a VB module as a filter to a
form. But only one of the fields if populating. I don't know how much
information is needed on your side but here's the code - it's a click event.
[The Year is an unbound field on the form. It's in a combo box. It seems to
be presenting properly but I just can't seem to get it to populate in the
next form.]

glngCurrentCustID = Me![CustID]
glngCurrentYear = Me![Year]

gstrWhereOrder = "[Year] =" & "'" & glngCurrentYear & "'" & ";
[CustomerID] = " & glngCurrentCustID

'===========================
' this seems to display the appropriate filter
'===================================
MsgBox gstrWhereOrder

' New order for current customer...

DoCmd.openForm FormName:="qryInvoice1", WhereCondition:=gstrWhereOrder, _
OpenArgs:="New"
DoCmd.Close acForm, Me.Name


The qryInvoice1 form is based on a query that pulls in all records and I
thought would filter by the CustID and the Year. Year is a String and CustID
is an autonumber.
Can anyone give me an idea as to what I'm doing wrong?
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