Not enough arguments...? (1 Viewer)

L4serK!LL

Registered User.
Local time
Today, 23:38
Joined
Jul 22, 2002
Messages
59
Code:
    Dim RST2 As Recordset
    Set RST2 = CurrentDb.OpenRecordset("SELECT * FROM Stopcode", dbOpenDynaset)
    RST2.MoveLast
    Do
        If (RST2("ID") = Me![ID]) Then
            If (RST2("Krediet") = 1 Or RST2("Stopcode") = 1) Then
                MsgBox "Deze klant dient CASH te betalen! " & IIf(RST2("Veld90") <> "", "(" & RST2("Veld90") & ")", "")
            End If
            Exit Do
        End If
        RST2.MovePrevious
    Loop While (Not RST2.BOF)
    RST2.Close
when running this piece of code I get an error on the 'OpenRecordset' line saying "Not enough arguments. Expected number of arguments: 1." When leaving out the 'dbOpenDynaset' the same error occurs... :confused:
 

crosmill

Registered User.
Local time
Today, 23:38
Joined
Sep 20, 2001
Messages
285
this works for me

Dim db As Database
Dim strSQL As String
Dim RST2 As Recordset

Set db = CurrentDb()

strSQL = "SELECT * FROM Stopcode"

Set RST2 = db.OpenRecordset(strSQL, dbOpenDynaset, dbConsistent, dbOptimistic)

Good luck
 

L4serK!LL

Registered User.
Local time
Today, 23:38
Joined
Jul 22, 2002
Messages
59
I get the same error on the OpenRecordset line than before after replacing my code with yours so the problem remains :(

Other ideas? :confused:
 

Users who are viewing this thread

Top Bottom