I'm running the following code on the 'on open' form event. The form’s data is a table named “Participants”. The two fields from this table that are on the form are ID and RegistrationID. The values of these two fields aren't coming through in my strSQL statment that's bolded below. When I look at the value of strSQL via a MsgBox, I see:
Insert into tblConcatenatePartIDs (RegistrationID, ParticipantID) values ('' ,'')
where I expected to see something like:
Insert into tblConcatenatePartIDs (RegistrationID, ParticipantID) values ('02315438188' ,'72')
Here's the code:
Dim exists_in_new_table As Integer
Dim strSQL As String
strSQL = "Delete from tblConcatenatePartIDs"
DoCmd.RunSQL strSQL
Me.Recordset.MoveFirst
Do While Not Me.Recordset.EOF
exists_in_new_table = DCount("*", "tblConcatenatePartIDs", "RegistrationID='" & Me.RegistrationID & "'")
tblConcatenatePartIDs
If exists_in_new_table = 0 Then
strSQL = "Insert into tblConcatenatePartIDs (RegistrationID, ParticipantID) values ('" & Me.RegistrationID & "' ,'" & Me.ID & "')"
DoCmd.RunSQL strSQL
Else …
Anna Jaeger
iMIS Database Support
Insert into tblConcatenatePartIDs (RegistrationID, ParticipantID) values ('' ,'')
where I expected to see something like:
Insert into tblConcatenatePartIDs (RegistrationID, ParticipantID) values ('02315438188' ,'72')
Here's the code:
Dim exists_in_new_table As Integer
Dim strSQL As String
strSQL = "Delete from tblConcatenatePartIDs"
DoCmd.RunSQL strSQL
Me.Recordset.MoveFirst
Do While Not Me.Recordset.EOF
exists_in_new_table = DCount("*", "tblConcatenatePartIDs", "RegistrationID='" & Me.RegistrationID & "'")
tblConcatenatePartIDs
If exists_in_new_table = 0 Then
strSQL = "Insert into tblConcatenatePartIDs (RegistrationID, ParticipantID) values ('" & Me.RegistrationID & "' ,'" & Me.ID & "')"
DoCmd.RunSQL strSQL
Else …
Anna Jaeger
iMIS Database Support