Datasheet form

K

KBDB

Does anyone know how to get the record number that you are currently on in a
datasheet form view?

For example: At the bottom of the datasheet is gives record 124 of 4185.
How can I access that number 124.

I would like to use it as an offset in the DoCmd.GoToRecord

Any help would be much appreciated.

Thanks
 
A

Allen Browne

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.
 
A

Allen Browne

Use the form's CurrentRecord property.

In general, this is not a great idea. If the user filters or sorts the form
differently after you save the offset, you won't arrive at the right place.
 
K

KBDB

Yes, you are right.
It works very well until I use the Filter.

I guess I don't know where to go from here. I have a pop up and I want to
synchronize it to the datasheet form the person is working with; so when they
click on a field (of the current record) the pop up comes up. How do I do
that if I can't use the current record location?
 
A

Allen Browne

If the other form is not already open, use the WhereCondition of OpenForm.

This example assumes a numeric field named ID:

Dim strWhere As String
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenForm "Form2", WhereCondition:=strWhere

If the target form is already open, FindFirst in its RecordsetClone, and set
the Bookmark.
 
K

KBDB

That worked great!

Thank you so very much!

KB

Allen Browne said:
If the other form is not already open, use the WhereCondition of OpenForm.

This example assumes a numeric field named ID:

Dim strWhere As String
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenForm "Form2", WhereCondition:=strWhere

If the target form is already open, FindFirst in its RecordsetClone, and set
the Bookmark.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

KBDB said:
Yes, you are right.
It works very well until I use the Filter.

I guess I don't know where to go from here. I have a pop up and I want to
synchronize it to the datasheet form the person is working with; so when
they
click on a field (of the current record) the pop up comes up. How do I do
that if I can't use the current record location?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top