 | 
08-Nov-2005, 12:53 PM
|  | Guest | | | | | | | | | | Duplicate records in a subform I have a form (formA) with a subform (formB) inside formA.
I need to duplicate the record in formA which is not a problem but i also Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/6856-duplicate-records-in-a-subform.html
want to duplicate the current record in formB at the same time without having
to place another duplicate button in this form.
Can anyone help me with this? * Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh! | 
08-Nov-2005, 12:53 PM
|  | Guest | | | | | | | | | | Re: Duplicate records in a subform The example below duplicates the invoice record in the main form and the
line items from the subform.
It illustrates 2 techniques:
- The main record is duplciated in the form's RecordsetClone (using DAO).
This gives you to new primary key value, which you need for the related
records.
- The child records are duplicated by executing an append query statement.
This creates them all in one pass.
The code then displays the newly created duplicate.
Private Sub cmdDupe_Click()
Dim strSql As String
Dim db As DAO.Database
Dim lngInvID As Long
Set db = DBEngine(0)(0)
If Me.Dirty Then 'Save first. Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
Me.Dirty = False
End If
If Me.NewRecord Then
MsgBox "Select the record to duplicate."
Else
'Duplicate the main record
With Me.RecordsetClone
.AddNew
!InvoiceDate = Date
!ClientID = Me.ClientID
'etc for other fields.
.Update
.Bookmark = .LastModified
lngInvID = !InvoiceID
'Duplicate the related records.
If Me.fInvoiceDetail.Form.RecordsetClone.RecordCount > 0 Then
strSql = "INSERT INTO tInvoiceDetail ( InvoiceID, Item,
Amount ) " & _
"SELECT " & lngInvID & " As NewInvoiceID,
tInvoiceDetail.Item, " & _
"tInvoiceDetail.Amount FROM tInvoiceDetail " & _
"WHERE (tInvoiceDetail.InvoiceID = " & Me.InvoiceID &
");"
db.Execute strSql, dbFailOnError
Else
MsgBox "Main record duplicated, but there were no related
records." Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
End If
'Display the duplicate.
Me.Bookmark = .LastModified
End With
End If
Set db = Nothing
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Barry" wrote in message
news:FD587861-DD2F-49D4-95E9-4CE4C0450729@microsoft.com...
>I have a form (formA) with a subform (formB) inside formA.
> I need to duplicate the record in formA which is not a problem but i also
> want to duplicate the current record in formB at the same time without
> having
> to place another duplicate button in this form.
>
> Can anyone help me with this? | 
09-Nov-2005, 17:50 PM
|  | Guest | | | | | | | | | | Re: Duplicate records in a subform Barry, this gets asked fairly often, so have created a web page explaining
the technique, and illustrating it with code that works with Northwind.
The article is:
Duplicate the record in form and subform
at: http://allenbrowne.com/ser-57.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org. Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
"Allen Browne" wrote in message
> "Barry" wrote in message
> news:FD587861-DD2F-49D4-95E9-4CE4C0450729@microsoft.com...
>>I have a form (formA) with a subform (formB) inside formA.
>> I need to duplicate the record in formA which is not a problem but i also
>> want to duplicate the current record in formB at the same time without Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
>> having to place another duplicate button in this form. | 
09-Nov-2005, 17:50 PM
|  | Guest | | | | | | | | | | Re: Duplicate records in a subform Thanks allen the code has helped me alot and with the explanation i should
now be able to get this working for me.
Thanks
"Allen Browne" wrote:
> Barry, this gets asked fairly often, so have created a web page explaining
> the technique, and illustrating it with code that works with Northwind. Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
>
> The article is:
> Duplicate the record in form and subform
> at:
> http://allenbrowne.com/ser-57.html
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Allen Browne" wrote in message Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
> > "Barry" wrote in message
> > news:FD587861-DD2F-49D4-95E9-4CE4C0450729@microsoft.com...
> >>I have a form (formA) with a subform (formB) inside formA.
> >> I need to duplicate the record in formA which is not a problem but i also
> >> want to duplicate the current record in formB at the same time without
> >> having to place another duplicate button in this form.
>
>
> | 
09-Nov-2005, 17:50 PM
|  | Guest | | | | | | | | | | Re: Duplicate records in a subform I have a problem with this code
it stops at the line DBEngine(0)(0).Execute strSql, dbFailOnError and gives
an
error message "Syntax error in INSERT INTO statement"
dbFailOnError has a value of 128 if this helps
"Allen Browne" wrote:
> The example below duplicates the invoice record in the main form and the
> line items from the subform. Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
>
> It illustrates 2 techniques:
> - The main record is duplciated in the form's RecordsetClone (using DAO).
> This gives you to new primary key value, which you need for the related
> records.
>
> - The child records are duplicated by executing an append query statement.
> This creates them all in one pass.
>
> The code then displays the newly created duplicate.
>
> Private Sub cmdDupe_Click()
> Dim strSql As String
> Dim db As DAO.Database
> Dim lngInvID As Long
>
> Set db = DBEngine(0)(0)
>
> If Me.Dirty Then 'Save first.
> Me.Dirty = False
> End If
> If Me.NewRecord Then
> MsgBox "Select the record to duplicate."
> Else
>
> 'Duplicate the main record
> With Me.RecordsetClone
> .AddNew
> !InvoiceDate = Date
> !ClientID = Me.ClientID
> 'etc for other fields.
> .Update
> .Bookmark = .LastModified
> lngInvID = !InvoiceID
>
> 'Duplicate the related records.
> If Me.fInvoiceDetail.Form.RecordsetClone.RecordCount > 0 Then
> strSql = "INSERT INTO tInvoiceDetail ( InvoiceID, Item,
> Amount ) " & _
> "SELECT " & lngInvID & " As NewInvoiceID,
> tInvoiceDetail.Item, " & _
> "tInvoiceDetail.Amount FROM tInvoiceDetail " & _
> "WHERE (tInvoiceDetail.InvoiceID = " & Me.InvoiceID &
> ");"
> db.Execute strSql, dbFailOnError
> Else
> MsgBox "Main record duplicated, but there were no related
> records."
> End If
>
> 'Display the duplicate.
> Me.Bookmark = .LastModified
> End With
> End If
>
> Set db = Nothing
> End Sub
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Barry" wrote in message
> news:FD587861-DD2F-49D4-95E9-4CE4C0450729@microsoft.com...
> >I have a form (formA) with a subform (formB) inside formA. Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
> > I need to duplicate the record in formA which is not a problem but i also
> > want to duplicate the current record in formB at the same time without
> > having
> > to place another duplicate button in this form.
> >
> > Can anyone help me with this?
>
>
> | 
09-Nov-2005, 17:51 PM
|  | Guest | | | | | | | | | | Re: Duplicate records in a subform The message indicates that you SQL string is not correct.
Immediately above the dbEngine... line, add this line:
Debug.Print strSQL
Run the code.
When if fails, open the Immediate Window (Ctrl+G).
Can you see what's wrong with the statement? E.g.:
- Spaces missing?
- No value where you expected one?
- Wrong field names?
- Field or table names that contain spaces, that were not in square
brackets?
Mock up a dummy query to compare it to if that helps.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Barry" wrote in message
news:448C0515-B211-49BF-9936-1FDF6935B247@microsoft.com...
>I have a problem with this code
>
> it stops at the line DBEngine(0)(0).Execute strSql, dbFailOnError and
> gives
> an
> error message "Syntax error in INSERT INTO statement"
>
> dbFailOnError has a value of 128 if this helps
>
>
>
> "Allen Browne" wrote:
>
>> The example below duplicates the invoice record in the main form and the
>> line items from the subform.
>>
>> It illustrates 2 techniques:
>> - The main record is duplciated in the form's RecordsetClone (using DAO).
>> This gives you to new primary key value, which you need for the related
>> records.
>>
>> - The child records are duplicated by executing an append query
>> statement.
>> This creates them all in one pass.
>>
>> The code then displays the newly created duplicate.
>> Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
>> Private Sub cmdDupe_Click()
>> Dim strSql As String
>> Dim db As DAO.Database
>> Dim lngInvID As Long
>>
>> Set db = DBEngine(0)(0)
>>
>> If Me.Dirty Then 'Save first.
>> Me.Dirty = False
>> End If
>> If Me.NewRecord Then
>> MsgBox "Select the record to duplicate."
>> Else
>>
>> 'Duplicate the main record
>> With Me.RecordsetClone
>> .AddNew
>> !InvoiceDate = Date
>> !ClientID = Me.ClientID
>> 'etc for other fields.
>> .Update
>> .Bookmark = .LastModified
>> lngInvID = !InvoiceID
>>
>> 'Duplicate the related records.
>> If Me.fInvoiceDetail.Form.RecordsetClone.RecordCount > 0 Then
>> strSql = "INSERT INTO tInvoiceDetail ( InvoiceID, Item,
>> Amount ) " & _
>> "SELECT " & lngInvID & " As NewInvoiceID,
>> tInvoiceDetail.Item, " & _
>> "tInvoiceDetail.Amount FROM tInvoiceDetail " & _
>> "WHERE (tInvoiceDetail.InvoiceID = " & Me.InvoiceID &
>> ");"
>> db.Execute strSql, dbFailOnError
>> Else
>> MsgBox "Main record duplicated, but there were no related Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
>> records."
>> End If
>>
>> 'Display the duplicate.
>> Me.Bookmark = .LastModified
>> End With
>> End If
>>
>> Set db = Nothing
>> End Sub
>>
>> "Barry" wrote in message
>> news:FD587861-DD2F-49D4-95E9-4CE4C0450729@microsoft.com...
>> >I have a form (formA) with a subform (formB) inside formA.
>> > I need to duplicate the record in formA which is not a problem but i
>> > also
>> > want to duplicate the current record in formB at the same time without
>> > having
>> > to place another duplicate button in this form.
>> >
>> > Can anyone help me with this? | 
09-Nov-2005, 17:51 PM
|  | Guest | | | | | | | | | | Re: Duplicate records in a subform i am not sure what the "NewID" is in the statement
"SELECT " & lngID & " As NewID
is this a function that is being called or should this be a field in the table
"Allen Browne" wrote:
> The message indicates that you SQL string is not correct.
>
> Immediately above the dbEngine... line, add this line:
> Debug.Print strSQL
> Run the code.
> When if fails, open the Immediate Window (Ctrl+G).
> Can you see what's wrong with the statement? E.g.:
> - Spaces missing?
> - No value where you expected one?
> - Wrong field names?
> - Field or table names that contain spaces, that were not in square
> brackets?
>
> Mock up a dummy query to compare it to if that helps.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Barry" wrote in message
> news:448C0515-B211-49BF-9936-1FDF6935B247@microsoft.com...
> >I have a problem with this code
> >
> > it stops at the line DBEngine(0)(0).Execute strSql, dbFailOnError and
> > gives
> > an
> > error message "Syntax error in INSERT INTO statement"
> >
> > dbFailOnError has a value of 128 if this helps
> >
> >
> >
> > "Allen Browne" wrote:
> >
> >> The example below duplicates the invoice record in the main form and the
> >> line items from the subform.
> >>
> >> It illustrates 2 techniques:
> >> - The main record is duplciated in the form's RecordsetClone (using DAO).
> >> This gives you to new primary key value, which you need for the related
> >> records.
> >>
> >> - The child records are duplicated by executing an append query
> >> statement.
> >> This creates them all in one pass.
> >>
> >> The code then displays the newly created duplicate.
> >>
> >> Private Sub cmdDupe_Click()
> >> Dim strSql As String
> >> Dim db As DAO.Database
> >> Dim lngInvID As Long
> >>
> >> Set db = DBEngine(0)(0)
> >>
> >> If Me.Dirty Then 'Save first.
> >> Me.Dirty = False
> >> End If
> >> If Me.NewRecord Then
> >> MsgBox "Select the record to duplicate."
> >> Else
> >>
> >> 'Duplicate the main record
> >> With Me.RecordsetClone
> >> .AddNew Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
> >> !InvoiceDate = Date
> >> !ClientID = Me.ClientID
> >> 'etc for other fields.
> >> .Update
> >> .Bookmark = .LastModified
> >> lngInvID = !InvoiceID
> >>
> >> 'Duplicate the related records.
> >> If Me.fInvoiceDetail.Form.RecordsetClone.RecordCount > 0 Then
> >> strSql = "INSERT INTO tInvoiceDetail ( InvoiceID, Item,
> >> Amount ) " & _
> >> "SELECT " & lngInvID & " As NewInvoiceID,
> >> tInvoiceDetail.Item, " & _
> >> "tInvoiceDetail.Amount FROM tInvoiceDetail " & _
> >> "WHERE (tInvoiceDetail.InvoiceID = " & Me.InvoiceID &
> >> ");"
> >> db.Execute strSql, dbFailOnError
> >> Else
> >> MsgBox "Main record duplicated, but there were no related
> >> records."
> >> End If Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
> >>
> >> 'Display the duplicate.
> >> Me.Bookmark = .LastModified
> >> End With
> >> End If
> >>
> >> Set db = Nothing
> >> End Sub
> >>
> >> "Barry" wrote in message
> >> news:FD587861-DD2F-49D4-95E9-4CE4C0450729@microsoft.com...
> >> >I have a form (formA) with a subform (formB) inside formA.
> >> > I need to duplicate the record in formA which is not a problem but i
> >> > also
> >> > want to duplicate the current record in formB at the same time without
> >> > having
> >> > to place another duplicate button in this form.
> >> >
> >> > Can anyone help me with this?
>
>
> | 
09-Nov-2005, 17:51 PM
|  | Guest | | | | | | | | | | Re: Duplicate records in a subform NewId is just the alias for the number.
You could call it anything at all.
The statement should end up as:
SELECT 789 AS YNotThisName, ...
What matters is that the items in the SELECT clause match the same fields as
those inside the brackets in the INSERT clause.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Barry" wrote in message
news:0BF15F7F-C0C0-49E2-B349-D50A609E6A88@microsoft.com...
>i am not sure what the "NewID" is in the statement
> "SELECT " & lngID & " As NewID
>
> is this a function that is being called or should this be a field in the
> table
>
>
>
> "Allen Browne" wrote:
>
>> The message indicates that you SQL string is not correct.
>>
>> Immediately above the dbEngine... line, add this line:
>> Debug.Print strSQL
>> Run the code.
>> When if fails, open the Immediate Window (Ctrl+G).
>> Can you see what's wrong with the statement? E.g.:
>> - Spaces missing?
>> - No value where you expected one?
>> - Wrong field names?
>> - Field or table names that contain spaces, that were not in square
>> brackets?
>>
>> Mock up a dummy query to compare it to if that helps.
>>
>> "Barry" wrote in message Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
>> news:448C0515-B211-49BF-9936-1FDF6935B247@microsoft.com...
>> >I have a problem with this code
>> >
>> > it stops at the line DBEngine(0)(0).Execute strSql, dbFailOnError and
>> > gives
>> > an
>> > error message "Syntax error in INSERT INTO statement"
>> >
>> > dbFailOnError has a value of 128 if this helps
>> >
>> >
>> >
>> > "Allen Browne" wrote:
>> >
>> >> The example below duplicates the invoice record in the main form and Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
>> >> the
>> >> line items from the subform.
>> >>
>> >> It illustrates 2 techniques:
>> >> - The main record is duplciated in the form's RecordsetClone (using
>> >> DAO).
>> >> This gives you to new primary key value, which you need for the
>> >> related
>> >> records.
>> >>
>> >> - The child records are duplicated by executing an append query
>> >> statement.
>> >> This creates them all in one pass.
>> >>
>> >> The code then displays the newly created duplicate.
>> >>
>> >> Private Sub cmdDupe_Click()
>> >> Dim strSql As String
>> >> Dim db As DAO.Database
>> >> Dim lngInvID As Long
>> >>
>> >> Set db = DBEngine(0)(0)
>> >>
>> >> If Me.Dirty Then 'Save first.
>> >> Me.Dirty = False
>> >> End If
>> >> If Me.NewRecord Then
>> >> MsgBox "Select the record to duplicate."
>> >> Else
>> >>
>> >> 'Duplicate the main record
>> >> With Me.RecordsetClone
>> >> .AddNew
>> >> !InvoiceDate = Date
>> >> !ClientID = Me.ClientID
>> >> 'etc for other fields.
>> >> .Update
>> >> .Bookmark = .LastModified
>> >> lngInvID = !InvoiceID
>> >>
>> >> 'Duplicate the related records.
>> >> If Me.fInvoiceDetail.Form.RecordsetClone.RecordCount > 0
>> >> Then
>> >> strSql = "INSERT INTO tInvoiceDetail ( InvoiceID,
>> >> Item,
>> >> Amount ) " & _
>> >> "SELECT " & lngInvID & " As NewInvoiceID,
>> >> tInvoiceDetail.Item, " & _
>> >> "tInvoiceDetail.Amount FROM tInvoiceDetail " & _
>> >> "WHERE (tInvoiceDetail.InvoiceID = " &
>> >> Me.InvoiceID &
>> >> ");"
>> >> db.Execute strSql, dbFailOnError
>> >> Else
>> >> MsgBox "Main record duplicated, but there were no
>> >> related
>> >> records."
>> >> End If
>> >>
>> >> 'Display the duplicate.
>> >> Me.Bookmark = .LastModified
>> >> End With
>> >> End If
>> >>
>> >> Set db = Nothing
>> >> End Sub
>> >>
>> >> "Barry" wrote in message
>> >> news:FD587861-DD2F-49D4-95E9-4CE4C0450729@microsoft.com...
>> >> >I have a form (formA) with a subform (formB) inside formA.
>> >> > I need to duplicate the record in formA which is not a problem but i
>> >> > also
>> >> > want to duplicate the current record in formB at the same time
>> >> > without
>> >> > having
>> >> > to place another duplicate button in this form.
>> >> >
>> >> > Can anyone help me with this? | 
09-Nov-2005, 17:51 PM
|  | Guest | | | | | | | | | | Re: Duplicate records in a subform I have got past this part of the code, I am using an SQL server to store the
data but now i receive an error " You must use dbSeeChanges option with Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
OpenRecordSet when accessing an SQL server table that has an identity column"
I have tried the following statement but i then get an error "Object required"
Set Duplicate = dbs.OpenRecordset(strSql, dbOpenDynaset, dbSeeChanges)
This gives duplicate a value of empty???
Can you help me...
"Allen Browne" wrote:
> NewId is just the alias for the number.
> You could call it anything at all.
> The statement should end up as:
> SELECT 789 AS YNotThisName, ...
>
> What matters is that the items in the SELECT clause match the same fields as
> those inside the brackets in the INSERT clause.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Barry" wrote in message
> news:0BF15F7F-C0C0-49E2-B349-D50A609E6A88@microsoft.com...
> >i am not sure what the "NewID" is in the statement
> > "SELECT " & lngID & " As NewID
> >
> > is this a function that is being called or should this be a field in the
> > table
> >
> >
> >
> > "Allen Browne" wrote:
> >
> >> The message indicates that you SQL string is not correct.
> >>
> >> Immediately above the dbEngine... line, add this line:
> >> Debug.Print strSQL
> >> Run the code.
> >> When if fails, open the Immediate Window (Ctrl+G).
> >> Can you see what's wrong with the statement? E.g.:
> >> - Spaces missing?
> >> - No value where you expected one?
> >> - Wrong field names?
> >> - Field or table names that contain spaces, that were not in square
> >> brackets?
> >>
> >> Mock up a dummy query to compare it to if that helps.
> >>
> >> "Barry" wrote in message
> >> news:448C0515-B211-49BF-9936-1FDF6935B247@microsoft.com...
> >> >I have a problem with this code
> >> >
> >> > it stops at the line DBEngine(0)(0).Execute strSql, dbFailOnError and
> >> > gives
> >> > an
> >> > error message "Syntax error in INSERT INTO statement"
> >> >
> >> > dbFailOnError has a value of 128 if this helps
> >> >
> >> >
> >> >
> >> > "Allen Browne" wrote:
> >> >
> >> >> The example below duplicates the invoice record in the main form and
> >> >> the
> >> >> line items from the subform.
> >> >>
> >> >> It illustrates 2 techniques:
> >> >> - The main record is duplciated in the form's RecordsetClone (using
> >> >> DAO).
> >> >> This gives you to new primary key value, which you need for the
> >> >> related
> >> >> records.
> >> >>
> >> >> - The child records are duplicated by executing an append query
> >> >> statement.
> >> >> This creates them all in one pass.
> >> >>
> >> >> The code then displays the newly created duplicate.
> >> >>
> >> >> Private Sub cmdDupe_Click()
> >> >> Dim strSql As String
> >> >> Dim db As DAO.Database
> >> >> Dim lngInvID As Long
> >> >>
> >> >> Set db = DBEngine(0)(0)
> >> >>
> >> >> If Me.Dirty Then 'Save first.
> >> >> Me.Dirty = False
> >> >> End If
> >> >> If Me.NewRecord Then
> >> >> MsgBox "Select the record to duplicate."
> >> >> Else
> >> >>
> >> >> 'Duplicate the main record
> >> >> With Me.RecordsetClone
> >> >> .AddNew
> >> >> !InvoiceDate = Date
> >> >> !ClientID = Me.ClientID
> >> >> 'etc for other fields.
> >> >> .Update
> >> >> .Bookmark = .LastModified
> >> >> lngInvID = !InvoiceID
> >> >>
> >> >> 'Duplicate the related records.
> >> >> If Me.fInvoiceDetail.Form.RecordsetClone.RecordCount > 0 Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6856
> >> >> Then
> >> >> strSql = "INSERT INTO tInvoiceDetail ( InvoiceID,
> >> >> Item,
> >> >> Amount ) " & _
> >> >> "SELECT " & lngInvID & " As NewInvoiceID,
> >> >> tInvoiceDetail.Item, " & _
> >> >> "tInvoiceDetail.Amount FROM tInvoiceDetail " & _
> >> >> "WHERE (tInvoiceDetail.InvoiceID = " &
> >> >> Me.InvoiceID &
> >> >> ");"
> >> >> db.Execute strSql, dbFailOnError
> >> >> Else
> >> >> MsgBox "Main record duplicated, but there were no
> >> >> related
> >> >> records."
> >> >> End If
> >> >>
> >> >> 'Display the duplicate.
> >> >> Me.Bookmark = .LastModified
> >> >> End With
> >> >> End If
> >> >>
> >> >> Set db = Nothing
> >> >> End Sub
> >> >>
> >> >> "Barry" wrote in message
> >> >> news:FD587861-DD2F-49D4-95E9-4CE4C0450729@microsoft.com...
> >> >> >I have a form (formA) with a subform (formB) inside formA.
> >> >> > I need to duplicate the record in formA which is not a problem but i
> >> >> > also
> >> >> > want to duplicate the current record in formB at the same time
> >> >> > without
> >> >> > having
> >> >> > to place another duplicate button in this form.
> >> >> >
> >> >> > Can anyone help me with this?
>
>
> | 
Support Us! Become a Promoter! | | Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh! | (View-All)
Members who have read this thread : 0
| | There are no names to display. | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Tools | Search | | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is On | | | | » Active Discussions | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | » Books You Should Read... | | | |