Help for checking query field value when form open

naobao

Registered User.
Local time
Today, 14:08
Joined
Feb 13, 2014
Messages
99
Hi,

When the form open, I want to use a fuction to check the query field value,
if the value is equal or bigger than 10, a form entry field will disable and show a picture, please help to give me a sample code!!

the query name is "check_today_tot", field name is "od_count", it only have one record.
form entry field name is "td"
picture object name is "check_pic"

Many thanks for help!!
 
Code:
Private Sub Form_Open(Cancel As Integer)
    If CurrentDb.OpenRecordset("select od_count from check_today_tot")(0) >= 10 Then
       td.Enabled = False
       check_pic.Picture = "C:\xyz\check_pic.jpg"
    End If
End Sub
 
Code:
Private Sub Form_Open(Cancel As Integer)
    If CurrentDb.OpenRecordset("select od_count from check_today_tot")(0) >= 10 Then
       td.Enabled = False
       check_pic.Picture = "C:\xyz\check_pic.jpg"
    End If
End Sub

Thank so much!!
 

Users who are viewing this thread

Back
Top Bottom