how is this module error solved ?

ariansman

Registered User.
Local time
Yesterday, 23:16
Joined
Apr 3, 2012
Messages
157
running module 1 of the access file on the following link:

http://www.rospina.com/Database1.accdb

results in this error: run-time error ‘94’, Invalid use of Null, highlighting to a line that i dont know how to resolve it.

can anybody help how to resolve this. i a know nothing about modules.

thank you very much

with courtesy to plog, a user on this site
 
The problem is because you are trying to loop through an empty recordset.. When it is empty there is No data for it to go through.. Thus throwing the Null object exception.. To do that, first you need to check if the Recordset is empty, if so nothing to do so simply exit the function.. I placed the simple If before the Do Until Loop..
Code:
If Not (rsfrom.BOF And rsfrom.EOF) Then
    Call MsgBox("Nothing to see here mate", vbInformation)
    Exit Function
End If
Do Until rsfrom.EOF
 [COLOR=Green] ' loops through every record in query and adds appropriate amount of records to Master table[/COLOR]
:
:
Try it and post back if you find any troubles..
 

Users who are viewing this thread

Back
Top Bottom