A
Ami
Hi everybody,
I am using the query example by Mr. Browne to duplicate a record in
form and subform.
This is for a database storing data about music cd for a small library.
They don't have money to buy a problem, but would like to have a
versatile system.
I am not very good at this, but I did not want to say no to them.
This is the code I am using:
------------
Private Sub CopiaIncolla_Click()
'Purpose: Duplicate the main form record and related records in the
subform.
[CUT]
strValue1 = InputBox("Inserisci il Nuovo CatalogueNr")
strValue2 = InputBox("Inserisci il Nuovo Univoco")
'Duplicate the main record: add to form's clone.
With Me.RecordsetClone
.AddNew
!CatalogueNr = strValue1
!Univoco = strValue2
!Title = Me.Title
!Label = Me.Casa_discografica
'etc for other fields.
.Update
-----------------------------------
This part is working fine.
BUT
THIS IS WHERE I AM STUCK
'Duplicate the related records: append query.
If
Me.[Sfr_Audio_PrincipaleTrack].Form.RecordsetClone.RecordCount > 0 Then
strSql = "INSERT INTO [Tbl_Audio_PRINCIPALETRACK]
(CatalogueNr, Univoco, TrackNr, Title, Length, Autore, Cantante, Strum,
Esecutore ) " & _
"SELECT '" & strValue1 & "' As CatalogueNr, '" &
strValue2 & "' as Univoco, TrackNr, Title, Length, Autore, Cantante,
Strum, Esecutore" & _
"FROM [Tbl_Audio_PRINCIPALETRACK] WHERE Univoco = "
& Me.Univoco & ";"
DBEngine(0)(0).Execute strSql, dbFailOnError
-----------------------------------------------
The PrimaryKey is an autonumber
Then I have the following fields:
CatalogueNr
Univoco
TrackNr
Title
and so on...
Catalogue Nr and Univoco are text and the same values I need to use for
the first append, so strvalue1 e strvalue2.
But now I keep getting an error message (error 2465, field "|" not
found).
What am I doing wrong?
Thanks in advance for the help!
Erika
I am using the query example by Mr. Browne to duplicate a record in
form and subform.
This is for a database storing data about music cd for a small library.
They don't have money to buy a problem, but would like to have a
versatile system.
I am not very good at this, but I did not want to say no to them.
This is the code I am using:
------------
Private Sub CopiaIncolla_Click()
'Purpose: Duplicate the main form record and related records in the
subform.
[CUT]
strValue1 = InputBox("Inserisci il Nuovo CatalogueNr")
strValue2 = InputBox("Inserisci il Nuovo Univoco")
'Duplicate the main record: add to form's clone.
With Me.RecordsetClone
.AddNew
!CatalogueNr = strValue1
!Univoco = strValue2
!Title = Me.Title
!Label = Me.Casa_discografica
'etc for other fields.
.Update
-----------------------------------
This part is working fine.
BUT
THIS IS WHERE I AM STUCK
'Duplicate the related records: append query.
If
Me.[Sfr_Audio_PrincipaleTrack].Form.RecordsetClone.RecordCount > 0 Then
strSql = "INSERT INTO [Tbl_Audio_PRINCIPALETRACK]
(CatalogueNr, Univoco, TrackNr, Title, Length, Autore, Cantante, Strum,
Esecutore ) " & _
"SELECT '" & strValue1 & "' As CatalogueNr, '" &
strValue2 & "' as Univoco, TrackNr, Title, Length, Autore, Cantante,
Strum, Esecutore" & _
"FROM [Tbl_Audio_PRINCIPALETRACK] WHERE Univoco = "
& Me.Univoco & ";"
DBEngine(0)(0).Execute strSql, dbFailOnError
-----------------------------------------------
The PrimaryKey is an autonumber
Then I have the following fields:
CatalogueNr
Univoco
TrackNr
Title
and so on...
Catalogue Nr and Univoco are text and the same values I need to use for
the first append, so strvalue1 e strvalue2.
But now I keep getting an error message (error 2465, field "|" not
found).
What am I doing wrong?
Thanks in advance for the help!
Erika