I assume you mean this code in the database I posted earlier:
Dim mySQL As String This just sets up a string variable to hold the SQL text of the query
'determine if there are already answers assigned to the displayed review; if so do not add them again. If not proceed with append query
If DCount("*", "AnswTBL", "Reviewer=" & Me.Record_ID) = 0 Then The IF..THEN checks to make sure that the question records have not already been added for the reviewer shown in the main form (identified in the Record_ID control on the main form). If they have not the code directly below executes. If records have already been added (i.e. the Dcount>0), then the message after the ELSE statement below will execute
The following is the actual SQL text; I just broke it down into three lines that add each successive line into the mySQL variable.
mySQL = "INSERT INTO AnswTbl ( Reviewer, Question, QuesNum )"
mySQL = mySQL & " SELECT " & Me.Record_ID & ", QuesTbl.Question, QuesTbl.[Question Number]"
mySQL = mySQL & " FROM QuesTbl"
The above query brings in the key field of the current record shown in the main form via the me.Record_ID. The "me." is just a shorthand for the current form, the SELECT..quesTbl.Question, QuesTbl.[Question Number] bring in the question information forom the QuesTbl
The following is the command that executes the query in the mySQL variable
CurrentDb.Execute mySQL, dbFailOnError
'requery the subform to show the appended records
Me.Child39.Requery This command requeries/refreshes the subform so it shows the records that were just added by the query above
Else
This is the response you will see if the IF..Then resulted in a false condition (i.e. the records have already been added
MsgBox "Questions have already been assigned to this reviewer"
End If