Label linked to a field

  • Thread starter Thread starter OmegaStealth
  • Start date Start date
O

OmegaStealth

Guest
I was wondering if it's possible to link a label on a form so that it automatically displays the contents of a field in a corresponding record?

eg I have a form for the rental of DVDs. On the form is a Text box labeled "RentalID", one for the "MemberID", both from my table "tbl_Rental". Below is the contents of a table displaying the dvds rented out for that rentalID. Is it possible to have a label or a piece of text that automatically displays the calculated field from a query that has that member's fullname in it?

I'd be most grateful
thx

:confused:
 
You cant linked label to a field, but you can put this code On Current event of form

Code:
YouLabel.Caption = [YourCalculatedField]
 
I keep getting the error:

"The expression On Current you entered as the event property setting produced the following error: Member already exists in an object module from which this object module derives."

I am confused

I have a little experience with access - mostly I've just been finding tutorial on the net and using those that seem close to what i want my database to do. I can't find anything to help me this time.
 
Do You have allready calculated field?
If Your Label is called "lblDisplay", and calculated field is "txtfullname" than code is:

Code:
Private Sub Form_Current()
lblDisplay.Caption = txtfullname
End Sub
 
Why do you need to have a label? If it is because you don't want the user to edit the field, instead have a textbox that is linked to the field, then set the textbox's locked=true, enabled=false, and if you then format it border-less and transparent, it'll look exactly as a label. And no VBA code is required.
 

Users who are viewing this thread

Back
Top Bottom