Link to home
Start Free TrialLog in
Avatar of AkAlan
AkAlan

asked on

MS Access Continuous Form - Retrieve row Key in VBA

What is the best way to retrieve a rows key value if you include the key field in the query but don't bind it to a text box?
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AkAlan
AkAlan

ASKER

Peter, Thanks, I had thought you could do that but when I tried to use that method to set a parameter directly in an ADODB Command, it didn't work, I had to first declare a variable, then set the variable to the keyvalue, then I used the variable in the Command.

Does Not work

Dim cmd as New ADODB.Command
With cmd
 .Parameters(@MyKeyValue") = Me.MyKeyValue


Does Work:

Dim myKeyValue as integer
myKeyValue = Me.MyKeyValue

Dim cmd as New ADODB.Command
With cmd
 .Parameters(@MyKeyValue") = myKeyValue