Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which event fires AFTER next record is displayed?

Status
Not open for further replies.

DKDiveDude

IS-IT--Management
Mar 9, 2003
24
US
Hello there,

Ok I'm fairly new to VBA so please forgive me if I'm axing a stupid question.

I'm trying to find an event that fires when I move to a new record AFTER the first or next record is displayed, not like the event OnCurrent that fires before the first or next record is displayed.

You see I want to refresh and display some unbound picture fields in a form from a file reference (hyperlink).

Sure my command button can refresh the pictures, but I would like to refresh the pictures automatically. If I don't refresh the pictures at all they stay the same on each record.

Thanks
 
Open your help file, go to the Answer Wizard tab and type in
"find out when events occur" (without the " " marks)

This will give you some decent information on which events occur when in a form.

Paul
 
I already looked there and I do NOT see any event that triggers when I move to a new record on an existing form AFTER the data is displayed.

I might be new to this VBA, but you assume that stupid and have not looked in the help file.

However I did, which is why I went ahead and searched for an access forum, registered and posted my question help.

I might have overseen an, for you "programmer", obvious simple solution which IS covered in the help file, however please forgive me as I, REPEAT, am new to this VBA thing and some of the talk in the help file is greek to me.

So let me try and put this another way, so I do not get another arrogant reply to look in the help file.

Question:

I am new to VBA programming for ACCESS.

I want to know if there is an event that triggers, EXACTLY when I, on a form, move to a new record, AFTER the data has loaded and is displayed.

I have looked in the help file, and if the answer is there I must either have overseen it, not found it or not understood the reply.

Thanks
 
Danish Diver,

I don't think he was assuming you are stupid, just that you hadn't looked in the help files. It's often best to mention that you've done this, if this is the case, as so many people don't.

In any case, I don't understand why the Current event won't work for you. You want to fill some unbound fields dependent on the contents of some bound fields, right? If that's the case, you should be able to do it with the current event. In any case, once the current event has fired, Access is pretty much sitting there waiting for another event.

If you've tried it and run into trouble, post your code and the results and we'll get you more specific answers.

Jeremy ==
Jeremy Wallace
AlphaBet City Dataworks
Affordable Development, Professionally Done

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Sorry Dude. I wasn't trying to imply anything at all. It looked like good info in the help file so I passed it on to you. If I was going to call you stupid there would be no doubt that it was done.

Paul
 
DKDiveDude,
Paul's post does not appear to me to have been arrogant. Keep in mind that nobody on these forums knows everything, and even those who know a lot don't always remember the exact details. When we don't know the absolute correct answer or aren't completely certain about it, it's common to point somebody to a place where they might be able to find the answer. This helps reduce misinformation while encouraging self-instruction. I do not consider it rude, condescending, or arrogant.

Also, please bear in mind that none of the posters on these forums get paid to answer our questions. When they do take the time to respond, I'm thankful for any answer I get.

Now, as far as your question, I have to state as a general disclaimer that Events are one of my weakest areas. I would examine the OnLoad event for the form or you could try changing the focus during the OnCurrent event and then using the GotFocus event. Bear in mind that these may or may not work, and you're probably better off following Jeremy's advice. I just wanted to try to add what I could to help.
 
Thanks for all your replies.

To: JeremyNYC (Programmer)

The Current event fires BEFORE the record data is displayed, like I wrote in my first post.

I'm interested in an event that fires AFTER the record data is displayed.

Thanks...
 
Diver,

I'm done.

You didn't read the part of my post where I told you that such an event does not exist. Or the part where I told you you could do you what you want with the events that exist in Access.

You didn't read the part of KornGeek's post where he told you that we're here helping people because we want to, not because we have something to gain from it.

And you did not take me up on my offer to look at any code and results you posted from your own efforts at getting this to work.

You did, however, get me to burn about seven minutes of my time checking things in the help file, by insisting that Paul, KornGeek, and I had missed something.

As I said, I'm done.

Jeremy ==
Jeremy Wallace
AlphaBet City Dataworks
Affordable Development, Professionally Done

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Hmm, now I really offended someone.

To: JeremyNYC (Programmer)

I'm very sorry, but I only see one post from you that says, and I quote:

"Danish Diver,
I don't think he was assuming you are stupid, just that you hadn't looked in the help files. It's often best to mention that you've done this, if this is the case, as so many people don't.
In any case, I don't understand why the Current event won't work for you. You want to fill some unbound fields dependent on the contents of some bound fields, right? If that's the case, you should be able to do it with the current event. In any case, once the current event has fired, Access is pretty much sitting there waiting for another event.
If you've tried it and run into trouble, post your code and the results and we'll get you more specific answers.
Jeremy"

Yes, I am from Denmark, and English is my second language, so I do not speak and read it as will as Danish. But would you please point out to me where you say:

"You didn't read the part of my post where I told you that such an event does not exist."

I must need glasses because I do not see it.

Sorry if I offended you and made you waste your time.

I've just had bad luck with forums lately, where I ask a question and people just tell me to look in the help file and other things.

I thought I was specific in my first post, where I explained the Current event did not work for me and still that was what you suggested.

:(
 
My best suggestion remains to try setting the focus to some control and trying that control's GotFocus event.

You might also want to try posting the code that is failing. Somebody might take a look at it and see something that you're missing.

Good luck.
 
DKDiveDude,

This thread seems to be degenerating. To get back to your original question, why doesn't the OnCurrent Event work for you?

I'm no expert but I'm fairly sure what you ask for doesn't exist. But, anyway, I can't see what you are trying to achieve. The User will not see the results of any action taken AFTER data is displayed until the next time the screen is refreshed and it would have the same effect as something done BEFORE that refresh.

If your Form is displayed in Single Forms mode then you should be able to refresh your picture in the OnCurrent event. If you are in Continuous Forms mode, you can't have different pictures on different records in unbound controls. So, to repeat what others have said, can you explain your problem in more detail or post your code, or both.

Enjoy,
Tony
 
Specificly I once in a while got some "DAO" error when using the OnCurrent event to update my unbound pictures fields, when jumping back and forth through records.

However after reading in almost all the answers, that the OnCurrent should work.

I suddenly thought that an Microsoft Office update would work, you see I had to reinstall my Windows 2000 a week ago, and since then I had not even updated to update SR1.

And now viola, the OnCurrent event works without a glitch.

Thanks to ALL who replied and please accept my apology for being frustrated.
 
Hmm, that is depressing.

A minute after I posted last, I got the same error I got earlier, when using "PageUp" on first record, to test and go one record further back.

This is the error I'm getting:

"Microsoft Visual Basic

Run-time error '2753'

A problem occured while Microsoft Access was communicating with the OLE server or ActiveX Control"

I keep getting this error, even when I click my command button, see code below.

"Private Sub bitFacialPicture_Name_Click()
If bitFacialPicture = True Then
oleFacialPicture.SourceDoc = "D:\Documents and Settings\DKDiveDude\My Documents\Face.jpg"
oleFacialPicture.Action = acOLECreateLink
Else
oleFacialPicture = Null
End If
End Sub"

The variable "bitFacialPicture" is a Yes/No field/checkbox. When checked the picture is supposed to be shown and I use the "oleFacialPicture = Null" if it's not set, to erase the picture from the unbound field as it does not clear by it self.

 
Furthermore, sometimes it works for a while and then if I click my above posted command button with code twice on the same record I get this error:

"Run-time error '2719':

A problem occured while accessing the OLE object"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top