PDA

Click to See Complete Forum and Search --> : Object variable not set


Harmough
Oct 3rd, 2000, 01:14 PM
I've opened a MS Access database by using this code:

Set DBMain = OpenDatabase(App.Path & "\Main.mdb")
Set RSMain = DBMain.OpenRecordset("Select * From MAIN")

Now I want to display the database information into a flexgrid control. But when I add this line:

Set FlexMain.DataSource = DBMain

it comes with the error message "Object variable or With block variable not set".

What am I doing wrong?

Thanks in advance.

mmmsonu
Oct 4th, 2000, 06:19 AM
please refresh recordset object then run your program

Harmough
Oct 4th, 2000, 03:34 PM
When using a data control, refreshing the recordset object would work, but now I can't seem to get it right. The only refresh method I could find is

DBMain.Recordsets.Refresh

but this gave the same error message.

Anyway, thanks for your reply.

Glenn
Oct 4th, 2000, 04:25 PM
I think you need to set the datasource property equal to the recordset RSMAIN

Set FlexMain.DataSource = RSMain

Harmough
Oct 5th, 2000, 09:23 AM
Nope, that didn't work either; the same result.

Thanks anyway!