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?
Microsoft Access

Avatar of undefined
Last Comment
AkAlan

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
peter57r

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck