Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 1st, 2003, 01:47 AM
smilegloria smilegloria is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 26 smilegloria User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Duplicate msgbox pop-up

Hi all,

I have created a form which contains many records. There is a valid date in this form. I want to add a validation checking on the valid date such that if the valid date is earlier than current date, a msgbox will be pop-up to alert the user. I add the following code:

Private Sub Form_Current()

Dim a As Variant
If ExpiryDate < Date Then
a = MsgBox("This Quotation Has Expired.", vbOKOnly, "Quotation Expired")
End If
End Sub

When I open this form, when the first record is already expired, the msgbox will pop-up before the form is opened. How can I open the form first then pop-up the msgbox?

Another problem is when i filter the form with a record that is expired, the msgbox will pop-up twice. Is there another way to do the same thing without these problems?

Thanks and Regards,
Gloria

Reply With Quote
  #2  
Old December 1st, 2003, 06:04 AM
TBÁrpi's Avatar
TBÁrpi TBÁrpi is offline
Lazy User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Hungary, Europe
Posts: 337 TBÁrpi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 5 m 5 sec
Reputation Power: 5
Send a message via MSN to TBÁrpi Send a message via Yahoo to TBÁrpi Send a message via Skype to TBÁrpi
Hi,

First problem:

Write a sub called CheckDate and include it into your form's code:

'**************************************
Private Sub CheckDate()
If ExpiryDate < Date Then
MsgBox("This Quotation Has Expired.", vbOKOnly, "Quotation Expired")
End If
End Sub
'**************************************

In design view, set the Form's timer property to 10 millseconds.

Inclute the following code into the OnTimer event handler of your form:

'**************************************
Me.TimerInterval=0
CheckDate
'**************************************

And include the following into the OnCurrent event handler of your form:

'**************************************
CheckDate
'**************************************

Hope this helps.
__________________
BRegs,
TBÁrpi
"I can only show you the door. You're the one who has to walk through it."

Reply With Quote
  #3  
Old December 1st, 2003, 09:02 PM
smilegloria smilegloria is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 26 smilegloria User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Still hv 2 msgbox pop-up after filtering

Hi TBÁrpi,

I have tried to follow your steps and made a macro and set the timer. But the second problem still occur, that is when i filter the form, the msgbox will pop-up twice. How to solve this problem?
Many thanks!

Gloria

Reply With Quote
  #4  
Old December 2nd, 2003, 04:56 AM
TBÁrpi's Avatar
TBÁrpi TBÁrpi is offline
Lazy User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Hungary, Europe
Posts: 337 TBÁrpi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 5 m 5 sec
Reputation Power: 5
Send a message via MSN to TBÁrpi Send a message via Yahoo to TBÁrpi Send a message via Skype to TBÁrpi
SmileGloria,
It seems that OnCurrent occurs twice for a reason. Send me the code that filters the form.

Reply With Quote
  #5  
Old December 2nd, 2003, 09:20 PM
smilegloria smilegloria is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 26 smilegloria User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi TBÁrpi,

I just created a query button on the form. when the query button is clicked, it will call a macro and the action is FilterByForm. No code is written for the filtering! Is it work? Cos for now, the msgbox still pop-up before the form load for the first expired record...

Many Thanks!

Best Regards,
Gloria

Reply With Quote
  #6  
Old December 3rd, 2003, 04:48 AM
TBÁrpi's Avatar
TBÁrpi TBÁrpi is offline
Lazy User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Hungary, Europe
Posts: 337 TBÁrpi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 5 m 5 sec
Reputation Power: 5
Send a message via MSN to TBÁrpi Send a message via Yahoo to TBÁrpi Send a message via Skype to TBÁrpi
Gloria,

In the OnCurrent event handler use
'**************************************
Me.TimerInterval = 10
'**************************************
instead of
'**************************************
CheckDate
'**************************************
Thus, when you step to a record, the timer will be 10 and the sub CheckDate will run. OnTimer sets the TimerInterval to 0 so no action will be taken again unless you step to an other record when the TimerINterval will be 10 again, and CheckDate will run again... and so on.

However, I created a small database and tried to follow your steps of filtering the form using a macro, but the MsgBox did not come twice.

There must be a difference...

Anyway, I enclose the DB and hope it makes sense.
Attached Files
File Type: zip gsmile.zip (29.0 KB, 238 views)

Reply With Quote
  #7  
Old December 3rd, 2003, 08:56 PM
smilegloria smilegloria is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 26 smilegloria User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

TBÁrpi,

I can solve the two problems by following your steps. It works well! Thanks alot!

BRgds,
Gloria

Reply With Quote
  #8  
Old December 4th, 2003, 07:41 AM
TBÁrpi's Avatar
TBÁrpi TBÁrpi is offline
Lazy User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Hungary, Europe
Posts: 337 TBÁrpi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 5 m 5 sec
Reputation Power: 5
Send a message via MSN to TBÁrpi Send a message via Yahoo to TBÁrpi Send a message via Skype to TBÁrpi
I am glad, good luck with the development.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Duplicate msgbox pop-up


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway