Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 9th, 2006, 06:17 AM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default Validating textbox in field level

I created text box in Form Details view by wizard - and althought in design view it's only one text-box with Name , when i open the form i have about 10 text-boxes (this is from table of course) . Now i want to control the input in each text box and i want for example that this will containt one of the following chars : "6" , "j" , "g" , "a" , "" .
How can i implement this ?


Reply With Quote
  #2 (permalink)  
Old February 10th, 2006, 08:30 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You can do this in Table Design by creating a validation rule.

You can also do this using one of the events on the text box (maybe Before Insert and use code to check the text entered.

Did you want to have 10 text boxes or just one? If the form is bound to a table, then just open the fields dialog box for the form and drag and drop the field to the form. You may also have the form in continuous form view.



mmcdonal
Reply With Quote
  #3 (permalink)  
Old February 10th, 2006, 08:32 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Sorry, you would use the InString function to check for your text. You check the string and if Instr = 0 then the value was not inserted.

mmcdonal
Reply With Quote
  #4 (permalink)  
Old February 10th, 2006, 12:05 PM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi ,
What i meant is that i each text box is bounded to column in a table , and when i open the form (not in design view) there are many text boxes (empty) . Now what i want is to control each this text box .

Reply With Quote
  #5 (permalink)  
Old February 10th, 2006, 12:39 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Start by using table level validation or input masks and see if this works for you.

mmcdonal
Reply With Quote
  #6 (permalink)  
Old February 15th, 2006, 11:57 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Create a table that holds only the allowed choices for that textbox.

Then in the form's design view, change that textbox into a combobox. Make its rowsource equal to the contents of that table you just created. Set the combobox's "Limit to List" property as YES.

When you open the form in Form View and the user goes to that combobox, the user can only choose from items you specified in the dropdown list.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validating multiple dates entered in textbox abhishekkashyap27 Javascript How-To 1 May 13th, 2008 06:55 AM
Tag library for field level role based security mmalik_altaf Pro JSP 0 June 7th, 2006 05:02 AM
Validating a hidden field mkerchenski ASP.NET 1.0 and 1.1 Basics 1 June 3rd, 2004 11:20 AM
Validating a form field against a database microchip Classic ASP Basics 2 April 24th, 2004 04:07 PM
validating rich text field for attachment Mimi Javascript How-To 4 August 25th, 2003 03:12 AM



All times are GMT -4. The time now is 02:14 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.