473,387 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Question on validation

Hi, sorry i have a question on validation. I think it must be too simple for you guys. Please pardon me.

I have a command button to update information entered by customer to the database. Everything is fine but i want to add a message to show e.g "Please enter your address" if the customer has left the address textbox empty.

I will have to add the validation into the Private Sub btnUpdateInfo_Click() - (the name for my insert button) right?

I entered this code but it doesn't work
If (txtAddress.value = "") Then
MsgBox "Enter your address"
End If

I tried using <IsNull(txtAddress.value)> and <txtAddress.value Is Null> but they don't work as well.

Can anyone help me solve this?

And can how can i apply to the rest of the textboxes as well?

Sorry for the trouble and thank you so much fo your effort and time.

Sincerely,
Idontknowanything
Feb 6 '07 #1
2 1544
ADezii
8,834 Expert 8TB
Hi, sorry i have a question on validation. I think it must be too simple for you guys. Please pardon me.

I have a command button to update information entered by customer to the database. Everything is fine but i want to add a message to show e.g "Please enter your address" if the customer has left the address textbox empty.

I will have to add the validation into the Private Sub btnUpdateInfo_Click() - (the name for my insert button) right?

I entered this code but it doesn't work
If (txtAddress.value = "") Then
MsgBox "Enter your address"
End If

I tried using <IsNull(txtAddress.value)> and <txtAddress.value Is Null> but they don't work as well.

Can anyone help me solve this?

And can how can i apply to the rest of the textboxes as well?

Sorry for the trouble and thank you so much fo your effort and time.

Sincerely,
Idontknowanything
Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me![txtAddress]) Then
  2.    'code here
  3. End If
Feb 6 '07 #2
NeoPa
32,556 Expert Mod 16PB
Firstly, an empty control will return a Null value rather than an empty string ("").
That said, it is not usual to need a Command Button to save a record on an Access form. Simply moving from one record to another on a bound form will trigger the update. Handling that would be done in the form's BeforeUpdate event procedure.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.     If IsNull(Me!txtAddress) Then
  3.         Call MsgBox("No address entered")
  4.         Cancel = True
  5.     End If
  6. End Sub
Feb 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Mike Sutton | last post by:
I had first tried a less active PHP group, but let me try here. I searched for this, but didn't find anything that appeared related. Possibly I didn't know what to search for. I am designing a...
7
by: Calan | last post by:
Mike, Your code on the dynamic input checking was excellent and very well explained. (The only thing I had to do was change the test for text input to be "1 > len of text", instead or "0 >...
16
by: Hosh | last post by:
I have a form on a webpage and want to use JavaScript validation for the form fields. I have searched the web for form validation scripts and have come up with scripts that only validate...
15
by: designconcepts | last post by:
bo'jour, bo'jour, So I have question to present to the forum about OOD. This is a Csharp forum, but C# is the lang of choice and the question is an exercise based on some comments by the chief...
3
by: Amadelle | last post by:
Hi All and thanks in advance, I wanted to know when is a good idea to use a static class (with static constructor) and when to use instance classes? I have read couple of articles on line and...
28
by: jakk | last post by:
Hello All, I have a question about how to handle exceptions. Iam working on an ASP.NET application which has a presentation layer, Business Layer and DataAccess Layer. Iam confused about where...
4
by: z. f. | last post by:
Hi, i stated that this is an advanced question because i have a post from few days ago that i received answers to with suggestions that looked good but did not work, so please if you post a...
8
by: Joe | last post by:
Hi, I have a form with three text fields and a Submit button. The two text fields have ReqiredFieldValidator and third text field has RegularExpressionValidator. The page validation works fine...
4
by: Mike Dee | last post by:
Hi - I recently took my site live and I'm getting quite a lot of HttpRequestValidationException errors "A potentially dangerous Request.Form value...". I'm seeing quite a lot of these various...
1
by: John Chan | last post by:
Hi, Im doing a maintenance application in ajax and coldfusion at work on IE6 exclusively. I have a save button on each form and i have to do various validations server side and on client side...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.