Sabtu, 29 April 2017

Re: [MS_AccessPros] Label visible or not visible according to conditions

 

John,


First of all sorry for not replying yesterday as i have to move from office.
Thank you very much for pointing me the error that "PassportExpiryDate" is not a valid field in tblPassport.

I checked it in "tblPassport" the field was named as ""Passport ExpiryDate" there was a space after Passport, which i removed and then all was OK.

Thank you once again,
regards,
Khalid
 


---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Khalid-

That tells me that PassportExpiryDate is not a field in tblPassport.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Apr 28, 2017, at 12:20 PM, khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



John,

Run-time error '2471':

The expression you entered as a query parameter produced this error:
'[PassportExpiryDate]'


---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Khalid-

What is the error?

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Apr 28, 2017, at 12:08 PM, khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Hi John,

It is giving error on

varZ = DLookup("[MemberID]", "tblPassport", "[PassportExpiryDate] < Date()")

The varible varZ what i defined was not giving error but the conditions were  not working.

Regards,
Khalid


---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Khalid-

Try this:

    varZ = DLookup("[MemberID]", "tblPassport", "[PassportExpiryDate] < Date()") 

And:

    varB = DLookup("[MemberID]", "tblCNIC", "[CNIC ExpiryDate] < Date()") 


John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Apr 28, 2017, at 10:30 AM, Khalid Tanweer khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Hi All, 

I have a Form "MainMenu" it has three Lables. My need is that if on Form "MainMenu" On Load event the conditions are true or false the following labels should be Visible or not Visible. 

LabelNotification1 
LabelNotification2 
LabelNotification3 

Form "MainMenu" On Load event is: 

Private Sub Form_Load() 
    '1st Check 
    Me.LabelNotification1.Visible = False 
    Dim varZ As Variant 
    varZ = DLookup("[MemberID]", "tblPassport", "[PassportExpiryDate]" < Date) 
'    varZ = DLookup("[MemberID]", "tblPassport", " Month([PassportExpiryDate])< Month(Date()) And Day([PassportExpiryDate])<Day(Date())") 
    If Not IsNull(varZ) Then 
        Me.LabelNotification1.Visible = True 
    Else 
        Me.LabelNotification1.Visible = False 
    End If 
    '----------------- 
    '2nd Check 
    Me.LabelNotification2.Visible = False 
    Dim varB As Variant 
    varB = DLookup("[MemberID]", "tblCNIC", "[CNIC ExpiryDate]" < Date) 
    If Not IsNull(varB) Then 
        Me.LabelNotification2.Visible = True 
    Else 
        Me.LabelNotification2.Visible = False 
    End If 
    '----------------- 
    '3rd Check 
    Me.LabelNotification3.Visible = False 
    Dim varX As Variant 
    varX = DLookup("[MemberID]", "Members", " Month([Dob])= Month(Date()) And Day([Dob])=Day(Date())") 
    If Not IsNull(varX) Then 
        Me.LabelNotification3.Visible = True 
    Else 
        Me.LabelNotification3.Visible = False 
    End If 
End Sub 
    '----------------- 
At present 3rd Check is working correctly, i need correct code for 1st Check and 2nd Check. 

Help needed please. 

Regards, 
Khalid 










__._,_.___

Posted by: khalidtanweerburrah@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (8)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar