switchboard query lookup

M

Mark

On my switchboard/form I would like to have a command
button be visible if there are records where employee
trainging dates are expired.

So, I have an employee table and a query that has criteria
that shows records of employees with expired dates. And I
have a report that lists these employees. Now I would
like to add to my swicthboard a command button that will
be visible only if there are records with expired dates,
so the report can be opened.

What is the way to go about this task? Can I use
something like "Dlookup" in connection with the
switchboards on open event?

Thanks for any assistance!!!
 
T

tina

try this:
create the command button on the form, and set its'
Visible property to False.
to the form's On Open event, add an event procedure with
the following code,
***AIR CODE***
Dim intCount As Integer
intCount = DCount
("PrimaryKeyField","TableName","TrainingDateField < Date
()")
If intCount > 0 Then
CommandButtonName.Visible = True
Else
CommandButtonName.Visible = False
End If

replace the field, table and object names above with the
correct names in your db, of course.

hth
 

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