Pieter,
Thank you
"Pieter Wijnen" wrote:
>
>
> In the AfterInsert Event in the form U can put
> (select Properties /Event / After Update Event / "builder" / Event
> Procedure)
>
>
> '--------------------------------------------------
>
> Sub Form_AfterInsert()
> Dim Db AS DAO.Database
> Dim QDef AS DAO.QueryDef
> Dim i AS Long
> Dim SQL AS String
>
> Set Db = Access.CurrentDb ' Pointer to DB
> SQL="PARAMETERS pNAME TEXT, pVal Long;" & VBA.VbCrlF & _
> "INSERT INTO TABLE2 ([NAME],Field2) VALUES (pName,pVal)"
> Set Qdef = Db.CreateQueryDef(VBA.vbNullString,SQL) ' Creates a temporary
> Query to insert records
>
> Qdef.Parameters("pName").Value = Me("Name").Value ' Retrieve the Value of
> the Forms Control "Name" & Assign to Query Parm
> For i = 1 To 31
> Qdef.Parameters("pVal").Value = i
> Qdef.Execute DAO.DbSeeChanges 'Insert one row of data
> Next ' Loop 1..31
> Set Qdef = Nothing
> Set Db = Nothing ' Cleanup Pointers
> End Sub
>
> '-------------------------------------
>
> PS Change Field & Control Names to whatever U Use
> HTH
>
> Pieter
>
>
> "gb_S49" <(E-Mail Removed)> wrote in message
> news:82FC4748-3131-450F-8F1E-(E-Mail Removed)...
> >I am a complete novice to access, so apologies for the simplicity of the
> > question.
> > I have 2 tables.
> > Table one contains a list of names etc.
> > Table 2 contains many columns but the second column contains numbers 1-31,
> > entries per name (table 1)
> > Is there a way that when I add a new entry to table 1, it will
> > automatically
> > create a additional 31 records (numbered 1-31) in table 2?
> > i hope this makes sense
>
>
>
|