5
votes

I have a continuous form - one of the fields on the form is RecordID.

I have a label on that form, that when clicked should produce a message box with the RecordID in it via VBA:

MsgBox Me.RecordID

The label is reproduced on each row of the Continuous Form, but will only reference the first record. Even though I can see the RecordID field is different in each row of the form, I always get the same result, in this case 80029.

What's up with that?

1
For other's benefit: I thought I had this problem when I was trying to get information onMouseMove - but thanks to the information here I realised it was just giving me the wrong Record because the onMouseMove does not select the record the user is hovering over, and so I was always seeing data for the 'selected' record rather than the 'hovered' one.Steve Taylor

1 Answers

5
votes

Me.RecordID refers to the RecordID of the current record, as indicated by the black triangle in the record selector:

ContinuousForm

A Label control on a form cannot receive the Focus, so when you click on the label in another record the current record does not change and you keep getting the same RecordID. Note that if you put the same code into the Click handler for a textbox (or some other control that can receive the Focus) then the current record will change and you'll get the RecordID of that record.