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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What event - populate var with field value 1

Status
Not open for further replies.

jfrizelle

Programmer
Jan 15, 2004
26
0
0
IE
Hi. I have a form / subform, and I want to populate a variable with the value of a field in the subform (if the user tries to delete a record on the subform I need to do some lookups based on the value.) This needs to happen for every record, regardless of whether it's the first record, a new record, has / hasn't been changed, etc.

However, I can't see what event will do this :-

The OnCurrent event only happens when focus *moves* from one record to another, so when I'm on the first record, it's not triggered.

The OnGotFocus event doesn't happen if a form has visible controls.

The OnActivate event sounds like it should do it, but doesn't (Why not? I don't know. I have a MsgBox to show the variable, but no msgbox is being displayed in OnActivate)

The BeforeDelConfirm Event sounded good, but of course the field is blank in that Event.

I tried putting it in the OnTimer Event with Timer set to 1...the msgbox kept displaying and I had to End Task - I can get rid if the msgbox from the code of course, but I don't want to keep setting a variable - performance implications. I can't see any way of setting a Timer event to only happen once.

Anyone know how I can do this?

Thanks,
Jennie.
 
Jennie

To have a timer event fire only once, in the Form_Timer event, set the TimerInterval to 0, so it won't fire again.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top