Add a record to a subform

TomBP

Registered User.
Local time
Yesterday, 21:00
Joined
Jul 6, 2006
Messages
49
Pic1-1.jpg


As you can see I have a form with a subform in it. What I want to achieve is that when I press add new record a blank record will popup in the subform without all the other records you currently see. An example of this is the picture under this.

Pic2-1.jpg


If I then fill in the new record row the record will be added to the main table.

I already tried it for myself but the problem that occurs with my macro is the following:

Pic3.jpg


The macro has the following design:

Pic4.jpg


How can I add a new record without opening the subform?
 
Use query or SQL to solve your problem .
Something like this

strSql = "INSERT INTO YourTBL (Firma,Factuurnummer,maand,Soort,Transport,Product)" & _
" SELECT [Forms]![YourFormName]![Firma] AS S1,[Forms]![YourFormName]![Factuurnummer] AS S2,[Forms]![YourFormName]![maand] AS S3,[Forms]![YourFormName]![Soort] AS S4,[Forms]![YourFormName]![Transport] AS S5,[Forms]![YourFormName]![Product] AS S6;"

Me.Refresh
DoCmd.RunSQL (strSql)
Me.SubFormName.requery
 
Thx for your reply but I got it working using this:

I put this behind "Add New Record" in the OnClick event.

Code:
Me.frmSubform.SetFocus
Me.fromSubform.Form.Firma.SetFocus
DoCmd.GoToRecord , , acNewRec
 

Users who are viewing this thread

Back
Top Bottom