dbTalk Databases Forums  

Determining which Record with VB

comp.databases.ms-access comp.databases.ms-access


Discuss Determining which Record with VB in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gord
 
Posts: n/a

Default Determining which Record with VB - 10-13-2008 , 08:49 PM






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



Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Determining which Record with VB - 10-13-2008 , 08:54 PM






Gord wrote:

Quote:
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.


Reply With Quote
  #3  
Old   
Gord
 
Posts: n/a

Default Re: Determining which Record with VB - 10-13-2008 , 10:32 PM



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" <oil (AT) vinegar (DOT) com> wrote

Quote:
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.



Reply With Quote
  #4  
Old   
Tony Toews [MVP]
 
Posts: n/a

Default Re: Determining which Record with VB - 10-13-2008 , 10:58 PM



"Gord" <x1gord1x (AT) telus (DOT) net> wrote:

Quote:
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/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.