By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 972 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

Determining which Record with VB

P: n/a
If I have a form open with a subform control on it in datasheet view that
has its record source set to a query or a table, is it possible to determine
which record the user has clicked into with VB? I don't mean the text box
with which you can determine the field/column, but the record (row). I
guess what I'm looking for would be the bookmark? (or some line numbering?)
or whatever information would aid in determining unambiguously which record
in the underlying table was being accessed.

Hope that makes sense. Any pointers would help as I have a couple of books
I can refer to and the online help to work out the details.

Thanks,

Gord

P.S. I'm using Access 2007
Oct 14 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Gord wrote:
If I have a form open with a subform control on it in datasheet view that
has its record source set to a query or a table, is it possible to determine
which record the user has clicked into with VB? I don't mean the text box
with which you can determine the field/column, but the record (row). I
guess what I'm looking for would be the bookmark? (or some line numbering?)
or whatever information would aid in determining unambiguously which record
in the underlying table was being accessed.

Hope that makes sense. Any pointers would help as I have a couple of books
I can refer to and the online help to work out the details.

Thanks,

Gord

P.S. I'm using Access 2007

You might want to check out AbsolutePosition and any code examples in help.
Oct 14 '08 #2

P: n/a
Thanks Salad,

That may be part of the solution but I think I'm still missing something
important before I can use that property.

I assume that when a query is run (or even just opening a table in datasheet
view I would think) that Access must create its own recordset to display the
records in that datasheet. It would be that recordset that I need to get
ahold of in code to work with. I tried setting my own recordset to the same
query as to what the subform datasheet is set to display but it would appear
the datasheet and my recordset are not 'linked'. For example, in the click
event in one the fields/columns textbox I displayed a message box to display
the value in that field. If I clicked in different records/rows, I get the
same value displayed as the first record. So the 'current record' in my
recordset is not responding to where I click on the datasheet.

I hope that gives the idea of where I'm coming from. In short, I can't
(don't know how) to detect which row has been clicked in code. The
AbsolutePosition property would seem to be a property of a recordset. I
don't know where this recordset is or how to create it?

Thanks,

Gord

"Salad" <oi*@vinegar.comwrote in message
news:sZ******************************@earthlink.co m...
Gord wrote:
>If I have a form open with a subform control on it in datasheet view that
has its record source set to a query or a table, is it possible to
determine which record the user has clicked into with VB? I don't mean
the text box with which you can determine the field/column, but the
record (row). I guess what I'm looking for would be the bookmark? (or
some line numbering?) or whatever information would aid in determining
unambiguously which record in the underlying table was being accessed.

Hope that makes sense. Any pointers would help as I have a couple of
books I can refer to and the online help to work out the details.

Thanks,

Gord

P.S. I'm using Access 2007
You might want to check out AbsolutePosition and any code examples in
help.

Oct 14 '08 #3

P: n/a
"Gord" <x1******@telus.netwrote:
>If I have a form open with a subform control on it in datasheet view that
has its record source set to a query or a table, is it possible to determine
which record the user has clicked into with VB? I don't mean the text box
with which you can determine the field/column, but the record (row). I
guess what I'm looking for would be the bookmark? (or some line numbering?)
or whatever information would aid in determining unambiguously which record
in the underlying table was being accessed.
Is the primary key of the record sufficient? If so please that on the subform and
make it hidden. When the user sets the focus to a record then the field will be
that value.

But I suspect that's not what you mean.

What is your objective?

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Oct 14 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.