a bookmark question

A

Andy Levy

Hi

I know access has a bookmark feature to take me to a specific record.
However i want to goto a specific record based on my own id number.

I have FormA open, and am using "DoCmd.OpenForm " to open Form B. I want to
tell Form B to go to a specific record id number. I do not want to use the
filter for the form. My only suggestion is to use the 'openargs '
parameter.

Can you think of a better way, where i dont need to include code in form B
to tell it to go to a specific record.

Thanks

Andy
 
P

PC Datasheet

Display the ID Number you want to go to on form A then use the following code
to open Form B:
DoCmd.OpenForm "[Form B]",,,"[ID Number] = " & Me!NameOfIDNumberTextboxOnFormA

This assumes ID Number is numeric. If it's string, use:
DoCmd.OpenForm "[Form B]",,,"[ID Number] = '" & Me!NameOfIDNumberTextboxOnFormA
& "'"
 
A

Andy Levy

Thanks for your help - though this does what i didnt want it to do. The
where clause causes a filter to take place - i just want to take the user to
the record, but still be able to navigate through all the other records,
without having to turn the filter off.

Many thanks again



PC Datasheet said:
Display the ID Number you want to go to on form A then use the following code
to open Form B:
DoCmd.OpenForm "[Form B]",,,"[ID Number] = " & Me!NameOfIDNumberTextboxOnFormA

This assumes ID Number is numeric. If it's string, use:
DoCmd.OpenForm "[Form B]",,,"[ID Number] = '" & Me!NameOfIDNumberTextboxOnFormA
& "'"

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Andy Levy said:
Hi

I know access has a bookmark feature to take me to a specific record.
However i want to goto a specific record based on my own id number.

I have FormA open, and am using "DoCmd.OpenForm " to open Form B. I want to
tell Form B to go to a specific record id number. I do not want to use the
filter for the form. My only suggestion is to use the 'openargs '
parameter.

Can you think of a better way, where i dont need to include code in form B
to tell it to go to a specific record.

Thanks

Andy
 
J

Jan G. Thorstensen

Hi, Andy
I have just found out a method my self. I use an unbound Combo Box which
contains, let say 2 Columns. Row source is the same as the row source in
Form B. If you set the first column width to 0, and the second to 3 cm, or
whatever you would want, you can write a few letters until you have the
right item. Now Column 0 will have the Id number which you will need. This
Id will be the argument to the following code snippet:


Public Sub GotoRecord(ByVal ArticleID As Long)
With Me.RecordsetClone
.FindFirst "[ArticleID ] = " & ArticleID
Me.Bookmark = .Bookmark
End With
End Sub

I do not have the Combo Box in another form. I have it in the same form in
the header section, and it works perfect. If you want to use two Forms, only
substitute the "Me" key word with
the Name of your Userform. Then add your own error traps.

Hope this will work for you as it did for me.

Good luck,
Jan
 

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