Khalid,
This is very easy to test by creating a new, blank query and entering this into the SQL view:
SELECT MemberID FROM tblPassPort WHERE PassportExpiryDate < Date()
Try it and you should find the problem immediately.
Regards,
Duane Hookom
Switzerland
From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of khalidtanweerburrah@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Friday, April 28, 2017 5:20 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Label visible or not visible according to conditions
Sent: Friday, April 28, 2017 5:20 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Label visible or not visible according to conditions
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-
Hi John,
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
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
http://www.viescas.com/
www.viescas.com Welcome to the home of John Viescas Consulting. If you're at all interested in Microsoft Access or SQL Server, this is the place to be! Check out the book ... |
(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
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: Duane Hookom <duanehookom@hotmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (7) |
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