VB code producing an error
Hi,
I'm working on the following code: -
Code:
Dim test As Database
Dim Rs As DAO.Recordset
Dim Msg As String
Dim bFlag As Boolean
Set Rs = CurrentDb.OpenRecordset("query", dbOpenStatic, dbReadOnly, dbOptimisticValue)
...
But I'm having trouble as it returns the Run Time error 3001 "Invalid Argument", the line of code that it doesn't like is -
Code:
Set Rs = CurrentDb.OpenRecordset("query", dbOpenDynaset, dbAppendOnly, dbOptimisticValue)
Can anyone help with a way to solve this error please? Or a way around it without using OpenRecordset?
I've been stuck trying to solve this error for 3 days now! :confused:
Thanks
Re: VB code producing an error
Try without the last argument:
Code:
Set Rs = CurrentDb.OpenRecordset("query", dbOpenStatic, dbReadOnly)
Re: VB code producing an error
Thanks for the response, I've tried it but it still produces the same error. Cant see why at all. Is there anything else you can think of?
Thanks
Re: VB code producing an error
How about this:
Code:
Set Rs = CurrentDb.OpenRecordset("query", dbOpenDynaset)
Re: VB code producing an error
Too few parameters: Expected 3 is the error I now get, so it needs 3 parts to the argument
Re: VB code producing an error
What is "query"?
That error comes from the "query".
Re: VB code producing an error
Sorted it, it was the references!! Thanks for the help guys