Populate subform record

fgaiga

Registered User.
Local time
Today, 01:41
Joined
Aug 25, 2005
Messages
21
Hi,

I've got a main form with some unbound fields and a subform. From the unbound fields in the mainform, I modify dynamically the RecordSource of my subform to display the information. ==> This works fine !!

When there is no information to display in my subform, I need to create a new record in my subform and populate automatically some of the fields in my subform.

The problem is that I am not able to use the GoTorecord,, acnewrec in the subform because Access tells me that the subform is not open. If I try to use the Openform command, I get a new subform window on the screen and that's not what I want because the subform is already displayed.

Here is part of the code:


DoCmd.OpenForm "Subform name"
DoCmd.GoToRecord acDataForm, "Subform name", acNewRec


:confused:
Cheers.

Fab.
 
I would insert a row with DAO or an append query and then requery the subform to show it.
 
What do you mean by DAO ??

You would do a SQL INSERT and then requery the subform that's what you mean ??
 
Usualy Works for me ...
Since i learned a bit more about SQL i always have all my boxes unbound and a OK button with a INSERT INTO command behind...works just fine

Dont forget to "Requery" after ;O)
 
dim rs As DAO.Recordset
Set rs = Me.SubformName.Form.RecordSetClone
rs.AddNew
rs!fld1 = Me.fld1
rs!fldZ = me.fldZ
rs.Update
 

Users who are viewing this thread

Back
Top Bottom