SunQuest
 
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

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:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old July 15th, 2004, 04:23 AM
Paula Paula is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 65 Paula User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 32 sec
Reputation Power: 4
Unhappy Please Please Help

I have a form in which 2 fields need to be populated in order for a value to be generated. Once the second field is populated the code runs to generate the value. (It runs on the change event of field 2). This is fine if a user fills the fields in the right order. But if they don't it all goes wrong.

So, user comes in and focus is on field 1 but instead of selecting field 1, they leave it blank and move on to field 2. On the lost focus event of field 1, I've added a statement which says if field 1 is null, return focus to it, put out a message saying populate field one. The idea is that they can't get off field 1 without populating it, therefore they will always fill everything in in the right order and the value i need will be generated. I've then made field 2 mandatory, so it has to be changed and the code has to run.

However, at the point where I re-set the focus to field 1 on the lost focus event, it does not re-set the focus. It leaves the focus on the second field (which is a combo box) and allows the user to poulate that field while field 1 is still null, hence no value generated.

How do I force the user to populate the first field before they populate the second? What am I doing wrong?

Reply With Quote
  #2  
Old July 15th, 2004, 04:28 AM
KevinRedfern KevinRedfern is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 7 KevinRedfern User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
try using

Private Sub Form_Current()

If Me.field1 = "" Or IsNull(Me.field1) Then

field2.enable = False
Else
field2..Enabled = True

End If

end sub


then use some code in the field1 property to re-activate field2 once there is a value in there.

This way the user can not touch field2 until field1 has a value in it.

hope this helps

Reply With Quote
  #3  
Old July 15th, 2004, 04:38 AM
Paula Paula is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 65 Paula User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 32 sec
Reputation Power: 4
Thankyou!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Please Please Help


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 6 hosted by Hostway