Getting to the right ID on a continuous form

  • Thread starter Thread starter Kevin C Niven
  • Start date Start date
K

Kevin C Niven

On a continuous subform, I have a button that opens up a simple form
that allows the user to enter a note for a particular record.

a field1 field2 [btn]
b field1 field2 [btn]
c field1 field2 [btn]
 
Kevin,
More information about this table, and how it might relate
to others in your app... would be useful but...
And, a separate button to go to each of multiple records is
unworkable.
And, you didn't mention how you know which (of multiple records)
you want to go to.

Some basics...
You create the ID field in your table design.
A common method, is an Autonumber field, to give each
record a unique key value.
In your table example... you could have created an autonumber
field called TransID... each record would have it's TransID value
assigned by Access at record creation.
TransID Field1 Field2
1 X Y
2 G Q
3 B T
4 X T etc....

This TransID has nothing to do with any other field in your table that
may be used to link to other tables. This is just to give each record
a unique key identifying value.
Now, you can go to any record with just one button.
Do the OpenForm method, and specify the particular TransID
you're looking for... in the Where argument of the OpenForm.

DoCmd.OpenForm "X",,, "TransID = " & Me.TransID
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
I dont know what this is about, but im sure it interesting.
Al Campagna said:
Kevin,
More information about this table, and how it might relate
to others in your app... would be useful but...
And, a separate button to go to each of multiple records is
unworkable.
And, you didn't mention how you know which (of multiple records)
you want to go to.

Some basics...
You create the ID field in your table design.
A common method, is an Autonumber field, to give each
record a unique key value.
In your table example... you could have created an autonumber
field called TransID... each record would have it's TransID value
assigned by Access at record creation.
TransID Field1 Field2
1 X Y
2 G Q
3 B T
4 X T etc....

This TransID has nothing to do with any other field in your table that
may be used to link to other tables. This is just to give each record
a unique key identifying value.
Now, you can go to any record with just one button.
Do the OpenForm method, and specify the particular TransID
you're looking for... in the Where argument of the OpenForm.

DoCmd.OpenForm "X",,, "TransID = " & Me.TransID
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."



Kevin C Niven said:
On a continuous subform, I have a button that opens up a simple form
that allows the user to enter a note for a particular record.

a field1 field2 [btn]
b field1 field2 [btn]
c field1 field2 [btn]
.
.
.

The problem is that if the user clicks, say, the button on the third
record down (c), that opens the note for the first record in the
continuous form (a). No matter which record's button the user clicks
on the continuous form, it always opens to the first record's note.

What I need to do, I guess, is get the ID of the record that the user
is clicking the button in and use DoCmd.OpenForm to open that
particular record's context note.

Is that correct? And how do I get the ID of the current record in a
continuous form?


Thanks,
Kevin
 
Back
Top