IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Update: (+edit)
I must amend my previous musings on what is happening. It appears as though a recordset reference is being lost somewhere when an error message is generated. I declare said recordset thusly outside of any procedures:

Dim rst As DAO.Recordset


In the Form_Load Sub I set it:

Set rst = CurrentDb.OpenRecordset("tblALS_Add", dbOpenDynaset)


This is referencing a different table from the one in current use by the form (I'm doing on-the-fly data entry verification). tblALS_Verify is the current table being used by the form, tblALS_Add is the outside one it is checking against).

After any old error message, this bit causes the problem:

rst.FindFirst strCriteria


It can't, apparently, find any reference to rst anymore. So I assume when a runtime error occurs, those references get dropped. Is there a different way of declaring these or Setting them so this won't occur?

[Edit] Yes, I know DAO is old. It's partially legacy code.
Expand Edited by acagle Dec. 29, 2004, 12:57:53 PM EST
New You're probably all over this, but...
have you verified that the reference is turned on for 'Microsoft DAO 3.6 Object Library' that it's higher priority than ActiveX Data Objects (I usually turn the latter off altogether)?

Personally, I define my recordset objects within my procedures, and if it's needed in another procedure I'll pass the reference in my parameters. Just remember to 'SET rst = Nothing' at the end of the defining procedure to clear the reference.

And yes I still use DAO regularly myself. I'm just more accustomed to it.
~~~)-Steven----

"I want you to remember that no bastard ever won a war by dying for his country.
He won it by making the other poor dumb bastard die for his country..."

General George S. Patton
New Re: You're probably all over this, but...
Yeah, I figured that 3.6 stuff out a while ago. I also discovered the original app I borrowed the code from almost does the same thing, but there are pseudo-error traps that keep it from erroring out. But the basic behavior is the same (it pops up the hard-coded error message a couple times before letting you kill it).

So anyway. . . . .the options aren't looking too good unless there's some way to get Access to stop dropping the reference on an error message.
New Where is the declaration exactly? And a few more q's.
1) I assume the declaration is in a bas module (not Form module), yes?

2) Is the same rst object used to hold different recordsets across multiple forms?

3) Could you post the Form_Load and Form_Activate code?

4) If you write an error handler in the form_load that looks something like this, what is written to your c:\\myerrors.log file?

Form_Load()

On error goto Load_Err

...

Load_Exit:
Exit Sub

Load_Err:
' I don't remember if DAO has an errors collection or not, but I think it does.
' If it doesn't, strike out the errX stuff below
Dim hFile as long
Dim errX as Error

hFile = Freefile()
Open "C:\\MyErrors.log" for Append as #hFile
Print #hFile, Err.Description
For Each errX in DAO.Errors
Print #hFile, errX.Description
Next errX
close #hFile
Resume Load_Exit
bcnu,
Mikem

Eine Leute. Eine Welt. Ein F\ufffdhrer.
(Just trying to be accepted in the New America)
Expand Edited by mmoffitt Dec. 30, 2004, 12:40:15 PM EST
New Did you get this fixed?
bcnu,
Mikem

Eine Leute. Eine Welt. Ein F\ufffdhrer.
(Just trying to be accepted in the New America)
New Re: Did you get this fixed?
Oops, forgot to get back. (I've been having employment issues)

I mostly solved it, but by punting. I've just gone after each individual instance that's causing an error message and dealing with it that way. So instead of going through and putting an error handler in every.single.Sub. I am just dealing with individual errors when they come up and making sure it doesn't error out to a run-time error message.

I need to fix this in future projects though. . . . .
     Access: Runtime error 91. - (acagle) - (22)
         I think that one means... - (pwhysall) - (10)
             Re: I think that one means... - (acagle) - (9)
                 From the 10 Commandments of C Programming: - (inthane-chan) - (8)
                     So. - (acagle) - (7)
                         In VB? - (JayMehaffey) - (5)
                             Re: In VB? - (acagle) - (4)
                                 You can use On Error GoTo - (ben_tilly) - (1)
                                     That's still the way - (Steven A S)
                                 That was a joke - (JayMehaffey) - (1)
                                     For certain techniques, it works. - (static)
                         Opinions vary on "Global" error checking in VB. - (mmoffitt)
         That's the technical term "set" - (FuManChu) - (4)
             Re: That's the technical term "set" - (acagle) - (3)
                 Yes, unfortunately. - (FuManChu)
                 Putting it in every procedure is good practice for VB. - (mmoffitt) - (1)
                     Dangitall. - (acagle)
         Update: (+edit) - (acagle) - (5)
             You're probably all over this, but... - (Steven A S) - (1)
                 Re: You're probably all over this, but... - (acagle)
             Where is the declaration exactly? And a few more q's. - (mmoffitt)
             Did you get this fixed? -NT - (mmoffitt) - (1)
                 Re: Did you get this fixed? - (acagle)

When we check it out dem a brain it small. Seven time rise seven time will fall.
146 ms