G
Guest
I just want to loop through some records in a table in the current database.
All of the help examples appear to open another database. Do I need to use
'OpenDatabase' or can I just use 'OpenRecordset'. (I've done this loads of
times before in different jobs, but I don't have my previous code to copy and
I'm having a blonde moment!!)
The code I have so far is:
Dim db1 As Database
Dim rs1, rs2 As DAO.Recordset
Dim dtStartDate, dtEndDate As Date
'select distinct product codes from extract
db1 = OpenDatabase("my_current_database.mdb")
rs1 = OpenRecordset("SELECT DISTINCT [db_chge] FROM Dbchgeextractout")
I'm getting an error msg saying "Invalid use of property"
All of the help examples appear to open another database. Do I need to use
'OpenDatabase' or can I just use 'OpenRecordset'. (I've done this loads of
times before in different jobs, but I don't have my previous code to copy and
I'm having a blonde moment!!)
The code I have so far is:
Dim db1 As Database
Dim rs1, rs2 As DAO.Recordset
Dim dtStartDate, dtEndDate As Date
'select distinct product codes from extract
db1 = OpenDatabase("my_current_database.mdb")
rs1 = OpenRecordset("SELECT DISTINCT [db_chge] FROM Dbchgeextractout")
I'm getting an error msg saying "Invalid use of property"