473,408 Members | 1,852 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,408 software developers and data experts.

My IF Doesnt work.

Hi i've tried both
If Len(Form_form1.txtReceiptNo.Value) = 0 Then
MsgBox "Receipt Number is required", vbOKOnly, "Required Field"
Form_form1.txtReceiptNo.SetFoc*us
Exit Function
and
Trim(Form_form1. txtReceiptNo) = "" Then
MsgBox "Receipt Number is required", vbOKOnly, "Required Field"
Me.txtReceiptNo.SetFocus
Exit Function
And neither one display a Mesage box at all. What am i doing wrong? I
have not typed anything into this textbox.
Thanks

Nov 13 '05 #1
3 1182
<si************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi i've tried both
If Len(Form_form1.txtReceiptNo.Value) = 0 Then
MsgBox "Receipt Number is required", vbOKOnly, "Required Field"
Form_form1.txtReceiptNo.SetFoc*us
Exit Function
and
Trim(Form_form1. txtReceiptNo) = "" Then
MsgBox "Receipt Number is required", vbOKOnly, "Required Field"
Me.txtReceiptNo.SetFocus
Exit Function
And neither one display a Mesage box at all. What am i doing wrong? I
have not typed anything into this textbox.
Thanks
You don't say where you are writing this code (ie which event should trigger
it to happen) but in general when working with textboxes you should check
for null or use the Nz function which converts null values into zero-length
strings.
If IsNull(Me.txtReceiptNo) Then ...
If Len(Trim(Nz(Me.txtReceiptNo,"")))=0 Then...
Nov 13 '05 #2
si************@gmail.com wrote:
: Hi i've tried both
: If Len(Form_form1.txtReceiptNo.Value) = 0 Then

: MsgBox "Receipt Number is required", vbOKOnly, "Required Field"
: Form_form1.txtReceiptNo.SetFoc*us
: Exit Function

Try using Len(Form_form1.txtReceiptNo.Text) instead.
Value may not always update to what's in the textbox window.
--thelma

: Thanks

Nov 13 '05 #3
Thanks but that way you still have to set the focus beforhand with

Form_form1.txtReceiptNo.SetFocus

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Developwebsites | last post by:
#ifndef PERSON_H #define PERSON_H #include<iostream> #include<iomanip> #include<string> class Person { protected: char name;
1
by: Station Media | last post by:
Hi, here my problem, i use stored procedure in ACCESS database(latest version), and i would like to use this procedure but it doesnt work, do you know why ? Procedure: PARAMETERS MyField Text...
3
by: Clouds | last post by:
Hi ! How do I add the dynamic event handler for a dropdownlist present in the itemtemplate of a datalist !! I am doing it in the itemdatabound event of the datalist but it doesnt work... I am...
8
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This Custom validator is used for comparing a value enterd by the user against the primary key in the SQL database. IF the...
3
by: Bruno Paquette | last post by:
I have installed visual studio .net and now i started to write the first few examples from the 70-315 book by Kalani. It looks like all server side code that i put between <% %> doesnt process...
0
by: Juna | last post by:
I have been working in vs2003, but now started to work in vs2005 but the problem, I have simple web application not website, which work i mean open in browser when we press F5 or run the...
1
Digital Don
by: Digital Don | last post by:
I am writing a program for Peg solitaire... To check for no repetition of previous states I use a Set for storage of Board states.. The pronblem is when I declare the set as type char i.e. set...
3
by: jx2 | last post by:
hi guys i would appriciate your coments on this code - when i ran it for the very first time it doesnt see @last = LAST_INSERT_ID() but when i ran it next time it read it properly i need to know it...
1
by: Dany13 | last post by:
hi all. i using some text box for input value and some localvarible for passing this data to dataset . give instance for correct row of dataset and data in data table . use one gird view for...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.