number of records?

Looks like good code to me.

I'll ask again though, does the database compile properly? In any code window go to the debug menu and select the top item.

If so, you've got to start stripping the code down. Change the SQL statement to a simple one-liner. Shouldn't help, but you never know.

If that doesn't do it I'd create a blank form, and copy and paste all the controls onto it, then the code, and then you'll probably need to add some On Event links again as well. Sometimes, annoyingly, that is all you need to do.

Try those, in that order.
 
SammyJ said:
Looks like good code to me.

I'll ask again though, does the database compile properly? In any code window go to the debug menu and select the top item.

If so, you've got to start stripping the code down. Change the SQL statement to a simple one-liner. Shouldn't help, but you never know.

If that doesn't do it I'd create a blank form, and copy and paste all the controls onto it, then the code, and then you'll probably need to add some On Event links again as well. Sometimes, annoyingly, that is all you need to do.

Try those, in that order.
sorry...yes, it does compile correctly...i guess i'll have to start simpler and work my way up...

any idea on the run-time error message? what it means, how to correct it, etc?
 
"Run-time error 91: Object variable or With block variable not set" means that you are using a reference to an object which doesn't exist. (Ignoring the With part of the error message, seeing as you're not using a With statement.)

Since you are saying the error occurs on the statement which attempts to set the recordset, it is referring to your database variable I'd have thought. Can't see why it is not set though.

Put a stop on the line, and go into the debug window and see if db.name prints anything or something like that. If so then your database variable is fine.

Running out of options then. I have had to create a new form for no good reason before. You might have to.

Good luck, will check again from home when I get back there.
 
SammyJ said:
"Run-time error 91: Object variable or With block variable not set" means that you are using a reference to an object which doesn't exist. (Ignoring the With part of the error message, seeing as you're not using a With statement.)

Since you are saying the error occurs on the statement which attempts to set the recordset, it is referring to your database variable I'd have thought. Can't see why it is not set though.

Put a stop on the line, and go into the debug window and see if db.name prints anything or something like that. If so then your database variable is fine.

Running out of options then. I have had to create a new form for no good reason before. You might have to.

Good luck, will check again from home when I get back there.
in the immediate window i cannot get it to print the db name...if i put a breakpoint at rst = db.openrecordset(stSQL) and check out what db is...in the code window it says "db = nothing" when i hover over it...in the immediate window it says "db.name = <Objec variable or With block variable not set>"....so it appears as though db is not being set to anything....
 
And this is the line immediately after the Set db = CurrentDB line? Something is very wrong here.

Can you print CurrentDB.Name?

Try Set db = DBEngine(0)(0) instead. Does that work?

Try moving the Sub to a brand new non-form module.

Any of these working?
 
SammyJ said:
And this is the line immediately after the Set db = CurrentDB line? Something is very wrong here.

Can you print CurrentDB.Name?

Try Set db = DBEngine(0)(0) instead. Does that work?

Try moving the Sub to a brand new non-form module.

Any of these working?
cannot print currentdb.name either (same as db.name)....it says "item not found in collection" when i use dbengine(0)(0).....i guess i'll try to move it to another form and module and try it from there....
 
I would try it from a new DB, create the DB the goto the immideate window( ctr-G) and
print DBEngine(0)(0).Name

Peter
 
I'm with Peter here. Get a fresh DB happening and bring your objects in.

Check that CurrentDB.name is working at various stages.

All the stuff except your dodgy form to start with.

Then maybe bring it in and see if it still works.

Something is wrong with your form, if not your whole db.
 

Users who are viewing this thread

Back
Top Bottom