By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,484 Members | 1,811 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,484 IT Pros & Developers. It's quick & easy.

Record Selector [Event Procedure]

P: 47
All,

I am trying to have something happen on a form whenever the record selectors are clicked. This is access 2003. I tried the form's click event and that does not work at all.

Anyone know how I can get a procedure to trigger everytime the form's record selector is pressed?

Thanks to everyone. This is driving me crazy and any help that can be offered is greatly appreciated.

Thanks!
May 13 '08 #1
Share this Question
Share on Google+
10 Replies


missinglinq
Expert 2.5K+
P: 3,532
When you click on the record selector you're moving to another record, and the form's OnCurrent event is triggered, so that would be the appropriate event for whatever you're trying to do.

Linq ;0)>
May 13 '08 #2

FishVal
Expert 2.5K+
P: 2,653
Hi, jschmidt.

Actually there is no specific event to respond to record selector click.
But with a little workaround it could be sorted.
When record selector is clicked Form_Click event is fired, but it is fired as well when other form area (but the objects firing their own click event, e.g. detail section background, controls etc.) receives mouse click.
You may try to distinguish between these clicks using Form.SelHeight property which returns how many rows are selected. Really, when you click on record selector one row is selected otherwise no row is selected.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Click()
  2.     If Me.SelHeight = 1 Then
  3.         'code handling record selector click goes here
  4.         MsgBox "Record selector clicked"
  5.     End If
  6. End Sub
  7.  
Regards,
Fish

P.S. Actually, this doesn't work in datasheet view when record is already selected.
May 13 '08 #3

missinglinq
Expert 2.5K+
P: 3,532
I'm sorry, but when the Record Selector is clicked, the OnCurrent event does fire, even in Datasheet View, does it not?

Linq ;0)>
May 14 '08 #4

FishVal
Expert 2.5K+
P: 2,653
I'm sorry, but when the Record Selector is clicked, the OnCurrent event does fire, even in Datasheet View, does it not?

Linq ;0)>
I'm sorry too, but no Form_Current event is fired when clicking on record selector. I mean this bar on the left side of the form where triangle and pen icons appear.
Do you mean the same or do you mean navigation bar?
May 14 '08 #5

missinglinq
Expert 2.5K+
P: 3,532
What do you think happens when you "click" on the record selector? Access moves from whatever record has focus to the record you clicked on. This record then becomes the the "current" record!

Place this code behind a datasheet form:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.  MsgBox "The OnCurrent Event has fired!"
  3. End Sub
  4.  
Now click on the Recored Selector and see what happens.

Linq
May 14 '08 #6

FishVal
Expert 2.5K+
P: 2,653
Apologies, Linq.

And what will happen if you click on record selector of current record? In single form view there is no other option. ;) And what If you just move to another record?

Kind regards,
Fish
May 14 '08 #7

missinglinq
Expert 2.5K+
P: 3,532
And what will happen if you click on record selector of current record? In single form view there is no other option. ;) And what If you just move to another record?
Nothing would happen, of course! But why would you want whatever code the OP wants to tie to the event to happen again? The record selector isn't a command button, to be clicked willy-nilly; its purpose is to move to another record.
May 14 '08 #8

FishVal
Expert 2.5K+
P: 2,653
Nothing would happen, of course! But why would you want whatever code the OP wants to tie to the event to happen again? The record selector isn't a command button, to be clicked willy-nilly; its purpose is to move to another record.
Post deleted, content PMed.
May 14 '08 #9

NeoPa
Expert Mod 15k+
P: 31,186
It is nevertheless true that the Form_Current() procedure does not directly reflect clicking on a record selector I'm afraid Linq.

There are other ways of navigating between records than using the record selectors. I suspect it's also true to say that clicking on the record selector of the current record will not trigger the event.

It may possibly be used as an acceptable approximation, but it's not a direct answer for the question. Without knowing exactly what the OP requires we can only guess what may be acceptable for their particular requirements.
May 15 '08 #10

P: 1
@missinglinq
Linq

Works like a charm! I needed a combo box to show or not show based on the value of another control while viewing records using the record selectors. After unsuccessfully trying a number of events I decided to search online. Bingo...the very answer I was searching for. Thank you much!
Apr 23 '13 #11

Post your reply

Sign in to post your reply or Sign up for a free account.