Solved

Validation Process

Posted on 2000-03-17
5
146 Views
Last Modified: 2010-05-02
If the END button is pressed I am trying to validate on a number of options, this includes trying to establish whether a Masked Edit box is actually blank or not. The code I am using does not appear to be doing the job. Can anyone see the problem with it

If tmpType = ("1") And _
frmSport1.Level1.Text = ("New Funding Enquiry") And _
    frmSport1.Level2.Text = ("World Class - Revenue") And _
    frmSport1.Level3.Text = ("World Class Events") And _
    msktxtEventDate.Text = ("") Or _
    txtProjectCost.Text = ("") Or _
    cmboBiddingStaging.Text = ("") Or _
    msktxtBidDeadline.Text = ("") Then
    Msg = "You have not completed the World Class Events Additional Information!"   ' Define message.
    Style = vbOKOnly + vbCritical ' Define buttons.
    Title = "Please Confirm"  ' Define title.
    Response = MsgBox(Msg, Style, Title)
    msktxtEventDate.SetFocus
End If
   
If frmSport1.Level1.Text = ("New Funding Enquiry") And _
    frmSport1.Level2.Text = ("World Class - Revenue") And _
    frmSport1.Level3.Text = ("World Class Events") And _
    msktxtEventDate.Text <> ("") Or _
    txtProjectCost.Text <> ("") Or _
    cmboBiddingStaging.Text <> ("") Or _
    msktxtBidDeadline.Text <> ("") Then
   
'after validity checks, sends data to clipboard for retrieval by teleconnect

Clipboard.SetText frmSport1.cmboTitle + CRLF + frmSport1.txtInit + CRLF + frmSport1.txtSurname + CRLF + frmSport1.txtPosition + CRLF + frmSport1.txtOrganisation + CRLF + frmSport1.txtAddress1 + CRLF + frmSport1.txtAddress2 + CRLF + frmSport1.txtAddress3 + CRLF + frmSport1.txtAddress4 + CRLF + frmSport1.txtPostcode + CRLF + frmSport1.txtTelephone1 + CRLF + frmSport1.txtTelephone2 + CRLF + frmSport1.ComboCallertype + CRLF + frmSport1.txtRegion + CRLF + frmSport1.txtLocalAuthority + CRLF + frmSport1.txtProject + CRLF + frmSport1.txtIntentDate + CRLF + frmSport1.txtDateClosed + CRLF + frmSport1.CmboAssignTo + CRLF + frmSport1.cmboPriority + CRLF + frmSport1.txtCallDets + CRLF + frmSport1.Level1 + CRLF + frmSport1.Level2 + CRLF + frmSport1.Level3 + CRLF + frmSport1.Level4 + CRLF + txtASpartnership + CRLF + txtASForm + CRLF + msktxtEventDate + CRLF + txtProjectCost _
+ CRLF + cmboBiddingStaging + CRLF + msktxtBidDeadline

End
End If
Else
End If
End Sub

Basically what happens is that if the End Button pressed and
msktxtEventDate  
txtProjectCost
cmboBiddingStaging
msktxtBidDeadline

are all blank it does not wait for the boxes to be filled, dumps to the clipboard and ends the program.
0
Comment
Question by:Mister_Simon
  • 3
5 Comments
 

Expert Comment

by:pinshah
Comment Utility
_
    frmSport1.Level2.Text = ("World Class - Revenue") And _
    frmSport1.Level3.Text = ("World Class Events") And _ (
    msktxtEventDate.Text <> ("") Or _
    txtProjectCost.Text <> ("") Or _
    cmboBiddingStaging.Text <> ("") Or _
    msktxtBidDeadline.Text <> ("")) Then
     

Just Add two parantheses. The problem is because of the precedence of the operator

0
 

Expert Comment

by:pinshah
Comment Utility
sorry a little change . Apply to the first statement

If tmpType = ("1") And _
frmSport1.Level1.Text = ("New Funding Enquiry") And _
    frmSport1.Level2.Text = ("World Class - Revenue") And _
    frmSport1.Level3.Text = ("World Class Events") And _
    (msktxtEventDate.Text = ("") Or _
    txtProjectCost.Text = ("") Or _
    cmboBiddingStaging.Text = ("") Or _
    msktxtBidDeadline.Text = ("")) Then

'Error Message

I think you need to revise your checking.

are you not checking if data is proper in the level(n) text boxes?




   
0
 

Accepted Solution

by:
pinshah earned 35 total points
Comment Utility
sorry a little change . Apply to the first statement

If tmpType = ("1") And _
frmSport1.Level1.Text = ("New Funding Enquiry") And _
    frmSport1.Level2.Text = ("World Class - Revenue") And _
    frmSport1.Level3.Text = ("World Class Events") And _
    (msktxtEventDate.Text = ("") Or _
    txtProjectCost.Text = ("") Or _
    cmboBiddingStaging.Text = ("") Or _
    msktxtBidDeadline.Text = ("")) Then

'Error Message

I think you need to revise your checking.

are you not checking if data is proper in the level(n) text boxes?




   
0
 

Author Comment

by:Mister_Simon
Comment Utility
Thanks Pinshah, still needed a little refining to work properly. See Below

Out of interest why does the series of OR statements need double bracketing ?


If tmpType = ("1") And _
frmSport1.Level1.Text = ("New Funding Enquiry") And _
    frmSport1.Level2.Text = ("World Class - Revenue") And _
    frmSport1.Level3.Text = ("World Class Events") And _
    (msktxtEventDate.Text = ("__/__/____") Or _
    txtProjectCost.Text = ("") Or _
    cmboBiddingStaging.Text = ("") Or _
    msktxtBidDeadline.Text = ("__/__/____")) Then
    Msg = "You have not completed the World Class Events Additional Information!"   ' Define message.
    Style = vbOKOnly + vbCritical ' Define buttons.
    Title = "Please Confirm"  ' Define title.
    Response = MsgBox(Msg, Style, Title)
    msktxtEventDate.SetFocus
End If

If tmpType = ("1") And _
frmSport1.Level1.Text = ("New Funding Enquiry") And _
    frmSport1.Level2.Text = ("World Class - Revenue") And _
    frmSport1.Level3.Text = ("World Class Events") And _
    (msktxtEventDate.Text <> ("__/__/____") And _
    txtProjectCost.Text <> ("") And _
    cmboBiddingStaging.Text <> ("") And _
    msktxtBidDeadline.Text <> ("__/__/____")) Then
   
'after validity checks, sends data to clipboard for retrieval by teleconnect

Clipboard.SetText frmSport1.cmboTitle + CRLF + frmSport1.txtInit + CRLF + frmSport1.txtSurname + CRLF + frmSport1.txtPosition + CRLF + frmSport1.txtOrganisation + CRLF + frmSport1.txtAddress1 + CRLF + frmSport1.txtAddress2 + CRLF + frmSport1.txtAddress3 + CRLF + frmSport1.txtAddress4 + CRLF + frmSport1.txtPostcode + CRLF + frmSport1.txtTelephone1 + CRLF + frmSport1.txtTelephone2 + CRLF + frmSport1.ComboCallertype + CRLF + frmSport1.txtRegion + CRLF + frmSport1.txtLocalAuthority + CRLF + frmSport1.txtProject + CRLF + frmSport1.txtIntentDate + CRLF + frmSport1.txtDateClosed + CRLF + frmSport1.CmboAssignTo + CRLF + frmSport1.cmboPriority + CRLF + frmSport1.txtCallDets + CRLF + frmSport1.Level1 + CRLF + frmSport1.Level2 + CRLF + frmSport1.Level3 + CRLF + frmSport1.Level4 + CRLF + txtASpartnership + CRLF + txtASForm + CRLF + msktxtEventDate + CRLF + txtProjectCost _
+ CRLF + cmboBiddingStaging + CRLF + msktxtBidDeadline

End
End If
0
 
LVL 1

Expert Comment

by:phiro
Comment Utility
Hmm, By giving the End command. the VB application  will drop everything and quit. No checking can be done after that because no events will be handled.
Better use the unload routine and let the Unload events of your forms do the work :

Dim f as Form

For each f in Forms
   Unload f
Next f

This will close your app in an ordely fashon.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now