Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 05-22-2013, 03:51 AM   #1
brainox
Newly Registered User
 
Join Date: May 2013
Posts: 24
Thanks: 8
Thanked 0 Times in 0 Posts
brainox is on a distinguished road
Restrict user input in a textbox depending on what iption the user has selected

I am building a form in access and I am trying to find a way where user input isn't possible in the associated textbox when "No" from on option box is selected, I understand that I might have to use VBA, but I am very inexperienced with it so any help and ideas will be greatly appreciated, many thanks

brainox is offline   Reply With Quote
Old 05-22-2013, 04:02 AM   #2
pr2-eugin
Super Moderator
 
pr2-eugin's Avatar
 
Join Date: Nov 2011
Location: Bournemouth, UK
Posts: 8,498
Thanks: 68
Thanked 2,065 Times in 2,014 Posts
pr2-eugin has a spectacular aura about pr2-eugin has a spectacular aura about pr2-eugin has a spectacular aura about
Re: Restrict user input in a textbox depending on what iption the user has selected

Hello brainox, Welcome to AWF..

You need to implement the Form Current event to get this working.. Something along the lines of..
Code:
Private Sub From_Current()
    If Me.optionBoxName = 2 Then
        Me.TextBoxToLock.Enabled = False
    Else
        Me.TextBoxToLock.Enabled =True
    End If
End Sub
The value 2, is based on the assumption the option box, which might be radio button, having two options Yes = 1 and No = 2.. But if it is something else, just change it accordingly..
__________________
Regards,
Paul Eugin

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
!
Windows 7 Professional, MS Access 2010
---------------------------------------------------------------------------------------------------------------------
If the above post has helped you, please click the scales
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
or click the 'Thumbs up'. Cheers.

---------------------------------------------------------------------------------------------------------------------



pr2-eugin is offline   Reply With Quote
The Following User Says Thank You to pr2-eugin For This Useful Post:
brainox (05-30-2013)
Old 05-30-2013, 02:49 AM   #3
brainox
Newly Registered User
 
Join Date: May 2013
Posts: 24
Thanks: 8
Thanked 0 Times in 0 Posts
brainox is on a distinguished road
Re: Restrict user input in a textbox depending on what iption the user has selected

That worked perfectly, thank you very much

brainox is offline   Reply With Quote
Old 05-30-2013, 04:45 AM   #4
pr2-eugin
Super Moderator
 
pr2-eugin's Avatar
 
Join Date: Nov 2011
Location: Bournemouth, UK
Posts: 8,498
Thanks: 68
Thanked 2,065 Times in 2,014 Posts
pr2-eugin has a spectacular aura about pr2-eugin has a spectacular aura about pr2-eugin has a spectacular aura about
Re: Restrict user input in a textbox depending on what iption the user has selected

Glad you have it working.. Good Luck..

__________________
Regards,
Paul Eugin

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
!
Windows 7 Professional, MS Access 2010
---------------------------------------------------------------------------------------------------------------------
If the above post has helped you, please click the scales
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
or click the 'Thumbs up'. Cheers.

---------------------------------------------------------------------------------------------------------------------



pr2-eugin is offline   Reply With Quote
Reply

Tags
access , forms , user input , vba

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting table fields from user textbox input 2149jamesb Forms 2 01-19-2012 11:12 AM
Query that searches a table and ask user for input depending on what it finds. JahJr Queries 2 12-09-2008 07:14 AM
Access 2007: Forms: Need to populate text boxes depending on user input hitesh_sid Forms 1 12-07-2008 08:03 AM
User input from textbox to table Astello Tables 6 10-09-2006 11:48 AM
Resize a textbox to fit a user selected font/size Nancy26 Forms 2 08-03-2001 01:07 PM




All times are GMT -8. The time now is 12:57 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World