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

DESPERATE for new record clause

Status
Not open for further replies.

KellyJo

Technical User
Sep 14, 2004
24
US
Hi! I am looking for some code that will help me with a staffing form I am doing.

After entering in the name and date scheduled fields, I'd like to be able to go to a new record that will automatically have the name field populated with the same value as the previous record. I am stuck on the populating the field part. Here's what I have:

Private Sub Date_Scheduled_AfterUpdate()
DoCmd.GoToRecord , , acNewRec
End Sub

What do I need to insert in this code in order to make it populate the name field?

I am doing this because I don't want to have to enter in the name EVERY time I put in another date scheduled for an employee. Thanks for any help!

KellyJo
 
This looks very much like Access coding, for that pleace have a look at the Access fora (there are 7 of them).

Well - since I'm typing (and assuming Access), you might consider using the after update or ofter insert event of the form to change the default value property of the name control, let's say it's named txtName:

[tt]me!txtName.DefaultValue=me!txtName.Value[/tt] ' or
[tt]me!txtName.DefaultValue= chr(34) & me!txtName.Value & chr(34)[/tt]

Also have a look at faq181-2886, where #3 addresses choosing the right forum:)

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top