473,473 Members | 1,477 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

To validate that the Combo box save's only 6 digits

3 New Member
Hi, I wanted the combo box in my form to accept only 6 digits not more or less than 6. Could anyone help with the code that I need to write in VB
Apr 19 '07 #1
2 1197
hariharanmca
1,977 Top Contributor
Hi, I wanted the combo box in my form to accept only 6 digits not more or less than 6. Could anyone help with the code that I need to write in VB
Expand|Select|Wrap|Line Numbers
  1. if len(trim(cmbName.Text))<>6 then
  2.          msgbox "Enter 6 digit",vbInformation
  3. end if
Apr 19 '07 #2
Killer42
8,435 Recognized Expert Expert
Expand|Select|Wrap|Line Numbers
  1. if len(trim(cmbName.Text))<>6 then
  2.          msgbox "Enter 6 digit",vbInformation
  3. end if
Thanks for that.

Just a note - you'll want to be careful where you do this kind of check. For example, if you do it in the LostFocus event, your user may find they can't quit the program because it won't let them go to the "Cancel/Exit" button
Apr 26 '07 #3

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

Similar topics

5
by: Rob Wahmann | last post by:
Not sure if my first message went through because of the attachment... I'm currently using formchek.js to validate various form fields, however, I cannot figure out how to validate a field with a...
6
by: Abby Lee | last post by:
I must confirm the user enters a value for each fund they need. I do not know how many fund entries there will be...it's expandable to handle each users needs. I must varify each fund they enter is...
3
by: B | last post by:
I know there are several ways to speed up combo boxes and form loading. Most of the solutions leave rowsource of the combo box blank and set the rowsource to a saved query or an SQL with a where...
1
by: L Mehl | last post by:
On my cmdSaveRecord, I check a couple of fields to confirm that an entry has been made before allowing the Save. I decided to - not put validation rules in table structure, and - validate on...
1
by: Will | last post by:
I have a combo box on a form which is based on table tblMachine. On that combo box I have four columns visible MachineNumber, description, location and type. The bound column is the MachineNumber...
2
by: | last post by:
I'm new using c#.net I need to validate the zipcode. How I can be sure that only zipcode are typed and when the users type 5 digits zipcode the "-" do not get save in the record. Rafael...
1
by: bbcdancer | last post by:
Is it possible to restrict the length of a text box in MS Access using VBA on condition to what is selected in a list combo box. Scenario: 1. I have a list combo box containing: AA BBB...
1
by: gdixon | last post by:
Greetings To All! I am using a Access 2003 and my programing skills are of the cut and paste variety. This means begining programming skills and on a good day perhaps middle of the road...
10
mariodavi
by: mariodavi | last post by:
Hi everybody, how to validate input text in the follow: if option combo = 1,2 e 3, input 1 and input 2 must be filled, if one of this values not selected in combo (to be others), filled input...
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
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...
1
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,...
1
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: 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...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.