M
Megan via AccessMonster.com
Hi.
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?
I hope I'm explaining it clearly.
Thanks.
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?
I hope I'm explaining it clearly.
Thanks.