new records

C

Chi

Hi,

I created a data entry form and used command button to save new record and
go to the main form. The new record appears on the main form only after I
close out the database. I would like the new record goes to the main form as
soon as I click the button. Please help.
Thanks
Chi Huynh
 
S

scubadiver

This is the code I use in the "on click" event and it works fine. Does it
look anything like yours?

With Me![records subform].Form.RecordsetClone
.AddNew
!RecordID = DMax("[RecordID]", "[tble_hrs]") + 1
!EmployeeID = Me![records subform].Form![EmployeeID]
!RecWk = DateAdd("d", 7, Me![records subform].Form![RecWk])
!Dept = Me![records subform].Form![Dept]
!CCentre = Me![records subform].Form![CCentre]
!Subdept = Me![records subform].Form![Subdept]
!RateID = Me![records subform].Form![RateID]
!HrsWrk = 0
!Wage = Me![records subform].Form![Wage]
.Update
End With
 
E

EeOr

your post isn't very clear about what it is asking for, is the data source
for thew main form the same data source as the one in the data entry one?
Perhaps you could use
"Forms![My Form].Refresh" (without the quotation marks) in the on
click event of your command button after the DoCmd.Close?

that way the data should be there.

If not can you maybe be a bit clearer on what exactly you want?

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top