Simple: Create a new record, update old form

Canderel

Registered User.
Local time
Today, 18:47
Joined
Mar 29, 2005
Messages
30
Hi... I searched quick, didn't find anythign, but you guys are so responsive... :D

Question:
Part 1. On TimeSheet form, I want to click to "create new job", and the Jobs Form opens, at a new record. Currently it opens at record 1.

Part 2. I foresee that when I return from the modal job form, the old form (timesheet) would not have updated the combobox to show the jobname I just entered.

I guess this is what subforms are, because I keep reading about them, but dunno what they are.

Thanks

-Reenen
 
Part1

From where you are opening the form put

DoCmd.GoToRecord , , acNewRec

Part2

You need to Requery it.
 
It should go to new record on the newly opened (modal) form. Currently it goes in the one I call it from.

But at least I know the code now. :)
 
Currently it goes in the one I call it from

How are you opening the form ... and where did you put the code ?

If you're opening the form from a command button, with the code:

DoCmd.OpenForm ....., you should put the DoCmd.GoToRecord, after the OpenForm statement.
 
Code:
sub btnClick()
    dim stDocName
    stDocName = "Job"
    DoCmd.OpenForm stDocName, , , , acAdd, acDialog
    DoCmd.Requery Me

the acAdd creates it at a new record. That's nice...

The requery me doesn't work, and gives errors.
 
Last edited:
you do not need to requery the newly opened form, you only need to requery the job form, so you can try putting Me.Requery on the onActivate event of your job form.
 

Users who are viewing this thread

Back
Top Bottom