Solved

MS Access Continuous Form - Retrieve row Key in VBA

Posted on 2012-03-15
2
268 Views
Last Modified: 2012-08-13
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?
0
Comment
Question by:AkAlan
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 37725549
In code you can use   me.keyfieldname   whether or not the field is on the form.  It must be in the form's recordsource of course.
0
 
LVL 6

Author Comment

by:AkAlan
ID: 37726678
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
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now