Well, I'm getting closer to getting this to work. :banghead:
I have a module that contains the following:
Public Sub SelectorAssignment()
Dim i As Integer
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("qryRandomizer1st")
For i = 0 To Forms!frmMenuPTLAssignment1st!txtA1 - 1
CurrentDb.Execute "INSERT INTO tblSelectorAssignments (SelectionDate,SelectionArea,LFName)VALUES (Date(),'A1','LFName')"
rs.MoveNext
Next i
For i = 0 To Forms!frmMenuPTLAssignment1st!txtB1 - 1
CurrentDb.Execute "INSERT INTO tblSelectorAssignments (SelectionDate,SelectionArea,LFName)VALUES (Date(),'B1',[LFName])"
rs.MoveNext
Next i
rs.Close
Set rs = Nothing
db.Close
End Sub
I am having trouble with the LFName field. I have a button on the form that will run the code above. The SelectionDate field populates correctly with the current date, the SelectionArea populates correctly with the area (A1 or B1 in the snipet above) but I cannot get the right code to enter the LFName field with an actual name.
I have tried numerous variations with quotes, single and double, ampersands and brackets but with no luck. If I put single quotes around LFName it runs without error but that is what it enters in the field. Any thing else I have tried brings up either "Too few parameters. Expected 1." or "Compile error: Expected: End of Statement".
Can you please tell me what I'm doing wrong? Thank you!