H
HLCruz via AccessMonster.com
I am trying to change the record source property of my form via code in VBA,
the code runs in the onclick event of a button.
I'd like for the code to create a criteria based on the selection of a combo
box. The value will be the record's street address.
The code I'm trying to piece together isn't working - the error I get is that
there is no such record. But, I happen to know that the record exists so I
suspect it's my code that is faulty.
Any help would be greatly appreciated!
Thank you - Heather
Private Sub ctlGoTo_Click()
Dim varCriteria As Variant
Const acbcQuote = """"
varCriteria = "PKey = " & Me.Combo83.Value & acbcQuote
Me.RecordSource = "SELECT * FROM sysqryResidentListByZip WHERE " &
varCriteria
ExitHere:
End Sub
the code runs in the onclick event of a button.
I'd like for the code to create a criteria based on the selection of a combo
box. The value will be the record's street address.
The code I'm trying to piece together isn't working - the error I get is that
there is no such record. But, I happen to know that the record exists so I
suspect it's my code that is faulty.
Any help would be greatly appreciated!
Thank you - Heather
Private Sub ctlGoTo_Click()
Dim varCriteria As Variant
Const acbcQuote = """"
varCriteria = "PKey = " & Me.Combo83.Value & acbcQuote
Me.RecordSource = "SELECT * FROM sysqryResidentListByZip WHERE " &
varCriteria
ExitHere:
End Sub