Invalid Argument

E

Eric

Why it gives error when i try to insert data:
Invalid Argument
---------------------------------------------------------------------------------------------------------------
Dim arr(99)
Dim qry As String, rst As Object
qry = "SELECT tbl_EquipmentChronology.Equipment1 FROM
tbl_EquipmentChronology INNER JOIN tbl_events ON
tbl_events.TicketNum=tbl_EquipmentChronology.TicketNum where
tbl_events.TicketNum=" &
Forms!tbl_PPVResearch_Edit!frm_Events!TicketNum & " and
tbl_events.PPVVOD_Outlet=tbl_EquipmentChronology.Outlet"
Set rst = CurrentDb.OpenRecordset(qry)
rst.MoveFirst
Do While Not rst.EOF
arr(i) = rst!Equipment1
i = i + 1
' Text2.Value = rst!Equipment1
rst.MoveNext
Loop

Dim qry2 As String, rst2 As Object
For i = 0 To 100
If arr(i) <> "" Then
ss = arr(i)
qry2 = "insert into equipm(equip) values('" & ss & "')"
Set rst2 = CurrentDb.OpenRecordset(qry2)
End If
Next
----------------------------------------------
 
J

Jeff L

You are trying to set rst2 equal to an action query. Try this instead.

Docmd.RunSql qry2

Hope that helps!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top