All,
I continue to find the information on this forum fantastic. Most of the time I can work out my issues but I am stumped again (with something no doubt very simple).
In my music database I am trying to copy information over from one track (Track A) to another (roles of individual musicians) on a different album (Track B). I want to use a simple VBA code as follows: look up the track on the other album (which has a unique TrackID) and copy the role/musician information over with the Track B unique TrackID. The code is as follows:
Private Sub cmbCopyRoles_Click()
Dim strSQL As String
strSQL = "INSERT INTO jtblTrackRoles (TrackID, Musician ID, RoleID)" _
& " SELECT " & Me.txtTrackID & "," _
& " MusicianID," _
& " RoleID" _
& " FROM jtblTrackRoles" _
& " WHERE TrackID = " & Me.cmbChooseRoles.Value
Debug.Print strSQL
CurrentDb.Execute strSQL, dbFailOnError
End Sub
The debug information is
INSERT INTO jtblTrackRoles (TrackID, Musician ID, RoleID) SELECT 3290, MusicianID, RoleID FROM jtblTrackRoles WHERE TrackID = 3233
which looks like what I am trying to achieve.
One thought is that there is a TrackRoleID Autonumber in the jtblTrackRoles. Does that matter? I assumed Access would autofill it.
Many thanks for any guidance!
I continue to find the information on this forum fantastic. Most of the time I can work out my issues but I am stumped again (with something no doubt very simple).
In my music database I am trying to copy information over from one track (Track A) to another (roles of individual musicians) on a different album (Track B). I want to use a simple VBA code as follows: look up the track on the other album (which has a unique TrackID) and copy the role/musician information over with the Track B unique TrackID. The code is as follows:
Private Sub cmbCopyRoles_Click()
Dim strSQL As String
strSQL = "INSERT INTO jtblTrackRoles (TrackID, Musician ID, RoleID)" _
& " SELECT " & Me.txtTrackID & "," _
& " MusicianID," _
& " RoleID" _
& " FROM jtblTrackRoles" _
& " WHERE TrackID = " & Me.cmbChooseRoles.Value
Debug.Print strSQL
CurrentDb.Execute strSQL, dbFailOnError
End Sub
The debug information is
INSERT INTO jtblTrackRoles (TrackID, Musician ID, RoleID) SELECT 3290, MusicianID, RoleID FROM jtblTrackRoles WHERE TrackID = 3233
which looks like what I am trying to achieve.
One thought is that there is a TrackRoleID Autonumber in the jtblTrackRoles. Does that matter? I assumed Access would autofill it.
Many thanks for any guidance!