I am trying to alert a user , by using a message box, to state the various missing data.This works OK except when all data is entered as appropriate I still get the "Warning Message" for missing data! The program therefore does not progress!
As you will have spotted I have used script from other sources as I am not at a level to write my own - hence my inability to solve the problem.
Any help, or pointers, would be greatly appreciated.
13 1891 ADezii 8,834
Recognized Expert Expert
boliches, I'm not speaking for the rest of the Moderators/Experts in this Forum, but personally I will not attempt to decipher 200 lines of code unles it is properly Formatted and Tagged. If you can get the code in a more readable and tagged format, I will be more than happy to have a look at it.
boliches, I'm not speaking for the rest of the Moderators/Experts in this Forum, but personally I will not attempt to decipher 200 lines of code unles it is properly Formatted and Tagged. If you can get the code in a more readable and tagged format, I will be more than happy to have a look at it.
I dont fully understand what you want, but I have cut it down to a manageable size (I hope) -
blnError = False
-
-
strError = "Please complete the following:" & vbCrLf
-
-
If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
strError = strError & "Vehicle Details" & vbCrLf
-
-
ElseIf Not IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
End If
-
If blnError = True Then
-
Cancel = True
-
MsgBox strError, vbOKOnly + vbCritical, "Stop!"
-
Exit Sub
-
End If
-
The problem is the MsgBox is still shown even when all relevant Text Boxes are filled
ADezii 8,834
Recognized Expert Expert
I dont fully understand what you want, but I have cut it down to a manageable size (I hope) -
blnError = False
-
-
strError = "Please complete the following:" & vbCrLf
-
-
If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
strError = strError & "Vehicle Details" & vbCrLf
-
-
ElseIf Not IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
End If
-
If blnError = True Then
-
Cancel = True
-
MsgBox strError, vbOKOnly + vbCritical, "Stop!"
-
Exit Sub
-
End If
-
The problem is the MsgBox is still shown even when all relevant Text Boxes are filled
This is what I was referring to, I'll look at it as soon as I get a chance. NOTE: Is there any reason why the Validation is not done in the BeforeUpdate() Event of frmDeal?
ADezii 8,834
Recognized Expert Expert
I dont fully understand what you want, but I have cut it down to a manageable size (I hope) -
blnError = False
-
-
strError = "Please complete the following:" & vbCrLf
-
-
If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
strError = strError & "Vehicle Details" & vbCrLf
-
-
ElseIf Not IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
End If
-
If blnError = True Then
-
Cancel = True
-
MsgBox strError, vbOKOnly + vbCritical, "Stop!"
-
Exit Sub
-
End If
-
The problem is the MsgBox is still shown even when all relevant Text Boxes are filled
It appears that with your current logic, blnError will never evaluate to False. In the If...End If Statements, it seems to me that the ElseIf Clauses (Not IsNull()) should set the value of blnError to False, and the code syntax can be shortened. A couple of examples will illlustrate my point: - If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
trError = strError & "Vehicle Details" & vbCrLf
-
ElseIf Not IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
End If
-
-
If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Miles]) Then
-
blnError = True
-
strError = strError & "Mileage" & vbCrLf
-
ElseIf Not IsNull([Forms]![frmDeal]![frmDealsSub].Form![Miles]) Then
-
blnError = True
-
End If
try -
'It's either Not Null or Null
-
If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
trError = strError & "Vehicle Details" & vbCrLf
-
Else
-
blnError = False
-
End If
-
-
'It's either Not Null or Null
-
If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Miles]) Then
-
blnError = True
-
strError = strError & "Mileage" & vbCrLf
-
Else
-
blnError = False
-
End If
-
It appears that with your current logic, blnError will never evaluate to False. In the If...End If Statements, it seems to me that the ElseIf Clauses (Not IsNull()) should set the value of blnError to False, and the code syntax can be shortened. A couple of examples will illlustrate my point: - If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
trError = strError & "Vehicle Details" & vbCrLf
-
ElseIf Not IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
End If
-
-
If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Miles]) Then
-
blnError = True
-
strError = strError & "Mileage" & vbCrLf
-
ElseIf Not IsNull([Forms]![frmDeal]![frmDealsSub].Form![Miles]) Then
-
blnError = True
-
End If
try -
'It's either Not Null or Null
-
If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Text62]) Then
-
blnError = True
-
trError = strError & "Vehicle Details" & vbCrLf
-
Else
-
blnError = False
-
End If
-
-
'It's either Not Null or Null
-
If IsNull([Forms]![frmDeal]![frmDealsSub].Form![Miles]) Then
-
blnError = True
-
strError = strError & "Mileage" & vbCrLf
-
Else
-
blnError = False
-
End If
-
Have tried your suggestion, but for some reason when a textbox is null "blnError" still shows "blnError = False" and not "blnError = True"! WHY?? Is it because at the very beginning of the code I have -
Dim blnError As String
-
blnError = False
-
I have concluded the script with: -
If blnError = True Then
-
Cancel = True
-
MsgBox strError, vbOKOnly + vbCritical, "Stop!"
-
Exit Sub
-
Else: GoTo Continue
-
End If
-
-
Would this be right? As I get the feeling this code is not as you guys would write it! (" Continue:" is where the concluding code is to complete the task)
Your help please as I am struggling with getting blnError to equal the correct action ie False when False and True when True.
I meant to ask how you "Formatted and Tagged" the script to make it easier to read, also what is the benefit of putting the script in the "Before Update" event procedure as against on a Command Button? Is it a speed related thing?
ADezii 8,834
Recognized Expert Expert
I meant to ask how you "Formatted and Tagged" the script to make it easier to read, also what is the benefit of putting the script in the "Before Update" event procedure as against on a Command Button? Is it a speed related thing?
Have tried your suggestion, but for some reason when a textbox is null "blnError" still shows "blnError = False" and not "blnError = True"! WHY?? Is it because at the very beginning of the code I have
- Dim blnError As String
-
blnError = False
- 'The correct Syntax should be:
-
Dim blnError As Boolean
-
blnError = False
I meant to ask how you "Formatted and Tagged" the script to make it easier to read, also what is the benefit of putting the script in the "Before Update" event procedure as against on a Command Button? Is it a speed related thing?
The BeforeUpdate() Event of the Form fires before the actual data present on the Form is Saved to the underlying Record Source and is the logical location for Validation Code. You 'Format' and 'Tag' code segments by the use of Indentations and the Code Tags present in Edit Mod (#). Select a specific code block, then click on the # sign and designate the code context as text, vb, sql, etc. http://www.thescripts.com/forum/faq...._read_and_post boliches, there appears to numerous problems with your code segment, too many for a back-and-forth conversation. If you like, you can send me the Database as an E-Mail Attachment and I'll have a good look at it when I get a chance. The only problem is that it will not be anytime soon and the code itself is not simply a couple of lines. Let me know what you would like to do.
Have amended the syntax, but still am failing to get the blnError = False to blnError = True when a text box is "Null". What am I doing wrong?
Thanks for the update on Formatting etc.
Regards
Have amended the syntax, but still am failing to get the blnError = False to blnError = True when a text box is "Null". What am I doing wrong?
Thanks for the update on Formatting etc.
Regards
Thanks for your interest in my problem, but the database is quite sizeable and may be difficult for me to get you to where the problem is within the project.
My main issue here is that I want to alert a user that info is missing from a form, and therfore (via a msgbox) inform that user which items are missing! Have I gone about it in totally the wrong way? If so could you please advise.
Many thanks. (Really appreciate your time!)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Steven James Samuel Stapleton |
last post by:
Will calling ksort() on an array speed up it's access?
For example, I have the array $file_index, which is accessed by a key (the
entry id) and has two sub elements in a one dimensional array (line number
of the start of the entry in the file, and the byte offset of the start of
the entry).
so, I might have an array that can be represented thus:
{
|
by: pilar |
last post by:
Hi All,
It is possible to restrict data entry for 2 fields at the same time?,
i know how this may sound for you, please don't insult me (just
kidding, this is a great newsgroup). In my first Access database I
just found a big design mistake. There is a table - tblsystem- with 2
fields -upperprinter and lowerprinter- this 2 fields contains the same
type of data, they store the printers serial numbers. Now I found
duplicate entries for the...
|
by: David C. Barber |
last post by:
upsized an MDB to ADP/SQL Server 2000 under Access 2000. All the DAO code
that I've changed to ADO code is working fine, HOWEVER the form Record
Source itself does not seem willing to return data. I've set the Record
Source to both the query, and the SQL contained within the query, and
although the system pauses long enough to have gone out and retrieved the
data, I can't see it. The form itself remains gray. In addition:
...
|
by: Gary Shell |
last post by:
I am experiencing some strange behavior between a UserControl's validating event and a treeview control. Initially, I thought it was related to an issue in the Knowledgebase article 810852 (http://support.microsoft.com/kb/810852), but then I realized that the hotfix mentioned was in .Net v1.1, which I am using.
I took the sample from that article and recreated the situation I see in my application. (Code included below.)
If you run the...
|
by: Martin |
last post by:
I hope not, but, I think the answer to this question is "it can't be done".
Northwind sample database. Orders form.
Go to a new record.
Select a customer in "Bill To:"
Don't enter any products whatsoever.
Now click or page up/down away from this new record.
You just created a new order without a single item having been ordered.
Not something a user should be able to do.
| |
by: jhutchings |
last post by:
Hello all, I have a form I designed for data entry. However, when I set
the form properties to Data Entry mode, the form completely disappears
for Access 2000 users. All they see is a white blank space. What could
be causing this? Thanks!
|
by: Hamed |
last post by:
Hello
I have a Data Entry Form having some controls including a TextBox. When the
user types an entry, I query a table and if it was entered before, I ask the
user (using ShowModal method of a custom message form) if he wants to see
his old entry in a new form. if he/she choose Yes, I create a new form and
show the previously entered data in it.
The problem is when I create and show the new form, the validating event is
fired two...
|
by: seltzer |
last post by:
I am using Access 2000 but I also have the 2003 version.
I am working on creating a data entry form in Access for a research study. Since there is a maximum of 255 fields per table in Access, I have to split the fields up (unfortunately). I am creating a form for each section and all of the respective fields, and then I am putting all these forms into one larger form as subforms. I have a few questions & am hoping someone has answers:
...
|
by: Peted |
last post by:
I have an amazing problem which i think i have no hope of solving
Im working with a c# dot net module that is hosted by and runs under a
delphi form envrioment. Dont ask me how this insanity has prevailed
it just is :)
My problem is this
im trying to validate the contents of a textbox (it has to be a normal
textbox) and on a c# winforms and i am calling the textbox validating
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |