Place Value In Tag

G

Guest

Thanks for taking the time to read my question.

I have a form on which I have labels. In the On Open event I want to be able
to save a number in the tag of each label.

rst.MoveFirst
Do Until rst.EOF
Me.Controls(rst!BookingRoomDaySlot).Top = rst!Position * 0.3937
* 1440 '0.3937 converts cm to in.
Me.Controls(rst!BookingRoomDaySlot).Height = rst!HeightOfSlot *
2 * 0.5 * 0.3937 * 1440 '0.3937 converts cm to in.
Me.Controls(rst!BookingRoomDaySlot).Tag = rst!tblBookingID
Me.Controls(rst!BookingRoomDaySlot).Visible = True
Debug.Print Me.Controls(rst!BookingRoomDaySlot).Tag
'This prints the correct value, but for some reason, it is not
saved to the Tag property
rst.MoveNext
Loop

This code works, and you can see the debug.print value in the Immediate
window.

However, when I mouse over the lable, the tag is "". Am I not using the Tag
property correctly?

Private Sub R2We1_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
MsgBox Me.Tag
'I get a message box with nothing in it.
End Sub

Not sure what I am doing wrong. What I want to accomplish in the end is,
store the recordID number in the tag, so that when I double click on the
label, a form will open and filter based on the OpenArgs (in which I'll put
the Tag value). Then I will be able to edit the record associated to the
recordID (Like in Outlook when you double click on a calendar item and then
can edit the info)

Thanks for the help.

Brad
 
J

Jayyde

Do you mean to be using the .ControlTipText property instead of the .Tag?
The .Tag isn't visible from what I understand...

hth
-Jayyde
 
M

Michel Walsh

Hi,


Me is not Me.ControlName, so Me.Tag is different than
Me.ControlName.Tag

You tested

MsgBox Me.Tag


against

Me.Controls(rst!BookingRoomDaySlot).Tag


and find them different. Does I have to say more :) ?



Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top