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

Access Novice - Recordset query

Status
Not open for further replies.

Nosh

Programmer
Jul 12, 2001
34
GB
Hi Folks,

I've been asked to look at an Access 97 system that a mate of my dads knocked together for his business.

When the system creates a new record it uses the DoCmd.GoToRecord method.

I need to set some values in the new record as soon as it has been created. The problem is that this way of doing things does not seem to create a recordset to work with??

I am used to dealing with recordsets and would usually set new values like:

With rst
.AddNew !LastName = strLast
!FirstName = strFirst
.Update
End With

But I don't see how I can do this...

I don't really want to have to change the way this system handles records as it will be a whole stack of work. Is there anyway around this??

Many Thanks
Nosh
 
I take it a new record is created from a button on a form, and the new blank record is displayed.
You can just add to the code that creates the new record to stick the values in the relative fields:
I don't know where you are getting strLast & First from, but it would go like:

DoCmd.GoToRecord acnew
me!LastName = strLast
me!FirstName = strFirst


HTH

Ben ----------------------------------------
Ben O'Hara
----------------------------------------
 
Thats done the job!!

Thanks very much for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top