Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

docmd.FindRecord on a sub form

Status
Not open for further replies.

MartinF

Technical User
Sep 19, 2000
143
0
0
FR
Hi,

I cannot seem to get docmd.findrecord to work on a sub form.
On my main form users can enter a record id in a text field, which then looks the record up on the sub form. The recordset for the subform is based on another field on the main form so that only records for the selected week are shown within the sub form. However i do not want to requery the sub form so that it only shows the required record, i need to keep them all showing, but have the specified one selected.

Any ideas,

Thanks in advance

MartinF
 
you need a "book mark"

Dim SyncCriteria As String
Dim f As Form, rs As Recordset

'Define the form object and recordset object
Set f = Me![your subform].Form
Set rs = f.RecordsetClone

' define the criteria used for the sync
SyncCriteria = "[your keyfield]=" & Me![your textbox]

' find the corresponding record in the Parts table
rs.FindFirst SyncCriteria
f.Bookmark = rs.Bookmark
---------------------------------------

also to use this in Access 2000
open VBA program and click on the "Tools" menu then "References"
then find "Microsft DAO 3.5 Object Library"
put a check in it.
then click OK
DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Excellent!, thank you DougP, this works perfect.

Regards,

MartinF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top