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

Create a record in subform

Status
Not open for further replies.

RandyMyers

IS-IT--Management
Apr 28, 2004
85
US
I am trying to create a new record in a subform when a certain event happens in the main form. I would then like to transfer data from the main form to the subform (such as department number).

I have been able to transfer data from the main form to the subform, however I have not been able to figure out how to create a new record in the subform to transfer the data to. It just over rights the current record in the subform.

Any ideas of how to do this?

 
Take a look at the DoCmd.GoToRecord method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PH,

I apprecaite your reply. Unfortunately I am not having any luck.

I have tried the DoCmd.GoToRecord in the subform and I can not get it to work.

It never seems to recognize the sub form...

I have tried:
DoCmd.GoToRecord , "Forms!frmSystems!frmSystemTranHistSub.Form", acNewRec

And:
DoCmd.OpenForm "Forms!frmSystems!frmSystemTranHistSub.Form", acNormal, "", "", , acNewRec

I have tried it with or without the .Form and nothing seems to work. It basically does not recognize the sub form.

Is my syntax incorrect?

Basically, what I am trying to do is when a facility is changed in the inventory have the code automatically create a new transfer history sub record and populate the sub form with two fields from the main form, before these fields get updated, basically logging the previous data
 
In the mainform event procedure:
Me!frmSystemTranHistSub.SetFocus
DoCmd.GoToRecord , , acNewRec

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank you PH

This worked! I apprecaite you help...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top