Invalid or Unqualified Reference

KernelK

Registered User.
Local time
Today, 18:27
Joined
Oct 3, 2006
Messages
173
Strangeness. I have this IF statement:

Code:
If rsTasks.State = 0 Then
        .Open "SELECT * FROM ltblBillingTasks WHERE RecordID = " & rsBilling!EntryID & " ORDER BY DateStamp", cnBilling
    Else
        rsTasks.Requery
    End If

Code execution stops, and the compiler refuses to compile stating that !EntryID is an Invalid or Unqualified Reference. I was running the form with this IF statement with no problems, was working on other portions of the form, when I tried to run it, this error sprung to life.

I know that this is a correct reference. My recordset is declared and open by this point in code execution (besides, it would have given me an error stating that this operation can not be performed on a closed object anyway), and I make various references like this throughout the form without a hitch.

The strangest part of all is that if I open up the immeidiate window when code exectuion pauses and type ?rsBilling!EntryID , it returns the number 7 which is the appropriate EntryID in this case. Why would the immiediate window function correctly, but the compiler keeps on failing. It's as if Access isn't even checking the reference for validty and is just throwing a random error my way.
 
Is it ".Open" that is not qualified?
 
Actually the IF statement is nested in a With, so that .Open is qualified. The strangness continues though, as when I came into work today and tried to compile, it worked fine. No changes, the code is exactly how I left it. So very strange.
 

Users who are viewing this thread

Back
Top Bottom