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

Saving a record form another form

Status
Not open for further replies.

Harr777

Programmer
Sep 25, 2003
71
US
Greetings,

I am trying to write VBA code that would save the record that is currently in another From. I tried this:

Forms!frmMeterReads.DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Forms!frmMeterReads.DoCmd.GoToRecord , , acNewRec

But I get an error when I execute this code from a button in another Form.

Any ideas?

 
Hi,

The DoCmd method is a member of the Application object not a Form's, so you can't use it like that.

Although I haven't tested this yet, I would guess that you could try selecting the other form then saving the record, i.e:
Code:
[COLOR=blue]DoCmd.SelectObject acForm, "frmOtherFormName"

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.GoToRecord , , acNewRec

DoCmd.SelectObject acForm, Me.Name
[/color]

HTH

Dean :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top