Set Visible Property

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Everyon

Is it possible to set a label property to visible if a condition is met from a record in another table

The Form/Table is called FollowUp it has an invisible label that you can see in a design mode called CallBac

When a Check Box is ticked, the form/table is called Review, I want the label to be visible. I a
trying to use the expression builder to see how it should happen then copy the code into the on update propert
of my form but I am not having any success. Can anybody help

TI
 
You need to use something like:

If DLookup(**Fill in the blanks**) Then
MyLabel.Visible = True
End If

You can lookup the DLookup function in the Help file.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Jenny said:
Hi Everyone

Is it possible to set a label property to visible if a condition is met from a record in another table.

The Form/Table is called FollowUp it has an invisible label that you can see
in a design mode called CallBack
When a Check Box is ticked, the form/table is called Review, I want the label to be visible. I am
trying to use the expression builder to see how it should happen then copy the
code into the on update property
 
Hi Jenny

Be forewarned that I'm a new user, so take this information as such.

I was able to get a label on my form to change visible properties with this code. My form is defaulted to AllowEdits = False. I have this code placed in a listbox's GotFocus event so that when a user clicks into the listbox the code runs. Of course, you would have to change object names to fit your project and select your own event. (BTW, in my experimentations, I could not get this to work in the form's AfterUpdate, Dirty, or DataChange events.

Private Sub lboJobActivity_GotFocus(
Me.AllowEdits = Tru
Me.lblWorkedInFactory.Visible = Fals
If Me.cboActivityTypeID = 3 Then Me.lblWorkedInFactory.Visible = Tru
End Su

Hope this is helpful to you

Rick..

----- Jenny wrote: ----

Hi Everyon

Is it possible to set a label property to visible if a condition is met from a record in another table

The Form/Table is called FollowUp it has an invisible label that you can see in a design mode called CallBac

When a Check Box is ticked, the form/table is called Review, I want the label to be visible. I a
trying to use the expression builder to see how it should happen then copy the code into the on update propert
of my form but I am not having any success. Can anybody help

TI
 
Thanks for the response

I have tried both methods and help files with no succes
the code I am attempting to get to work is looking like this::

Private Sub Form_Open(Cancel As Integer)
If DLookup (Review.Chk = Yes) The
Me.CallBack.Visible = Tru
End If
End Su

I can set visible dependent on a result in the same form but not from another tabl

Help please what I am doing wron

TI
 
Apparently you didn't lookup the DLookup function in the Help file. I can
only guess your DLookup() might be

If DLookup ("Chk","Review") = Yes Then
This assumes there is only one record in the Review table and the Chk field
is a yes/no field.
 
Sorry to be an idiot

I did look at the help file in Access and followed the conventions for DLookup
but I still keep getting the error variable not defined

If DLookup ("Chk","Review") = Yes Then
Me.CallBack.Visible = True

or

If DLookup("[Chk]", "Review") = Yes
Me.CallBack.Visible = True

If there is more than 1 field in the Review table does the code alter ?

Thank you for your patience
 
DLookup() expects the first argument to be a field or expression, the second
is a table or select query. There is an optional third argument used to
filter the table or query to one or more records. For instance:
DLookup("empFirstName & ' ' & empLastName", "tblEmployees", "EmpID=3")
 
Duane,

You certainly have a lot of patience!!

Steve
PC Datasheet



Duane Hookom said:
DLookup() expects the first argument to be a field or expression, the second
is a table or select query. There is an optional third argument used to
filter the table or query to one or more records. For instance:
DLookup("empFirstName & ' ' & empLastName", "tblEmployees", "EmpID=3")

--
Duane Hookom
MS Access MVP


Jenny said:
Sorry to be an idiot

I did look at the help file in Access and followed the conventions for DLookup
but I still keep getting the error variable not defined

If DLookup ("Chk","Review") = Yes Then
Me.CallBack.Visible = True

or

If DLookup("[Chk]", "Review") = Yes
Me.CallBack.Visible = True

If there is more than 1 field in the Review table does the code alter ?

Thank you for your patience
 
Back
Top