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

Return to original record after updating form 1

Status
Not open for further replies.

NeilT123

Technical User
Jan 6, 2005
302
GB
I have a form which lists outstanding jobs and the form is sorted by priority, most urgent at the top.

I have a combo box for changing the priority and after updating the combo box the form requeries.

I would really like to be able to return to the record I am updating. I have tried me.Currentrecord and Me.CurrentrecordID but cant get this to work.

The unique identifier is FarmAccountNumber and after changing the priority and requerying the form I would like the cursor to be in tbAccountName of the record that I had just changed.

Have been scratching my head for too long on this so all suggestions appreciated.

Neil
 
Something like
Code:
 dim rs as dao.recordset
 dim acctNumber as string
 dim strCriteria as string
 
 set rs = me.recorset
 acctNumber = nz(me.FarmAccountNumber,"")
 strCriteria = "FarmAccountNumber = '" & acctNumber & ''"
 me.requery
 rs.findfirst strCriteria
of if acctNumber is numeric
Code:
 dim rs as dao.recordset
 dim acctNumber as long
 dim strCriteria as string
 
 set rs = me.recorset
 acctNumber = nz(me.FarmAccountNumber,0)
 strCriteria = "FarmAccountNumber = " & acctNumber
 me.requery
 rs.findfirst strCriteria
 
AcctNumber is numeric

slight typo re the d in recordset otherwise works exactly as required

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top