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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create single record recordset from form 1

Status
Not open for further replies.

James79

Programmer
Oct 25, 2001
15
0
0
AU
How do I create a recordset with the criteria being the primary key on an open form?
eg form is open with numeric field chargeID
rstTemp.openrecordset("select * from tblChargeProduct where ((tblChargeProduct.ChargeID)=[Forms]![frmCharge]![ChargeID])
This looks like it should work to me. Can it be done??
I am also wondering if I can get the recordset.findfirst function to operate with a numeric field. Can't seem to get that to happen either. Any assistance would be greatly appreciated.
 
First make sure you have Microsoft DAO 3.5X Object Library, or later, Check and the priority before the ADO libraries.
After that add this code on the After_Update() event of the field that holds the ChargeID

Dim rsTemp As Recordset

Set rsTemp = CurrentDb.OpenRecordset("tblChargeProduct", dbOpenDynaSet)

rsTemp.FindFirst "ChargeID = " & Me.ChargeID
Me.Bookmark = rsTemp.Bookmark

This should fix your problems. If you need more help let me know.
 
Thanks Heaps Toeshot

that dbOpenDynaSet was the trick. Works like a charm. Looks like that rs.findfirst really only works with the dbOpenDynaSet. Once again Thank you very much.
James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top