View Full Version : Expression Help


Silverspeed
10-12-2005, 09:14 AM
Ok so I’m using access and I have a table called members. This table had like 10 rows. Each one of them has its own description. I made this table into a form using a wizard. And at the bottom i added a label called "desc_lb"

Now when you open a table to input data it shows the description at the bottom but I want it to show that description in my label in the form. Now I tried a simple expression buy using the fields GotFocus. I made it display a string and on LooseFocus I made it get rid of the string.

But I want to know if there is an expression or macro that will get the description from he table and show it in the label, or will I have to do a lot of cut and pasting of text.

Please help.

~Amish

FoFa
10-12-2005, 10:43 AM
You can use the ON CURRENT event of the form to populate the label with the description. I would create the description field for each record, but make it an invisible field. In the ON CURRENT event just put the value of that invisible field into your label.
Basically create an event procedure on that event and use:
me.desc_lb.caption = me.mydescfield

I think that will work for you.

Silverspeed
10-12-2005, 10:57 AM
Not exactly. Like currently i have the code

Private Sub Forname_GotFocus()
desc_lb.Caption = "The Customers Forname"
End Sub

Private Sub Forname_LostFocus()
desc_lb.Caption = ""
End Sub


So when it gets the focus it shows a description i tell it.

But intead of the string i want it to show the description i have inputted in the table design. If you get what i mean

FoFa
10-12-2005, 01:49 PM
Is the description part of the current row?
Yes, then what I said is still true about an invisible field.
No, then use something like DLOOKUP to go get the value.