Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / August 2006

Tip: Looking for answers? Try searching our database.

Requiring field based another fields answer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
timglass - 23 Aug 2006 19:37 GMT
I have a field in a form that I only want a user to input information in if
another field is not null.  Does anyone know how?
MrMMM - 23 Aug 2006 19:48 GMT
The easiest way is to use conditional formatting (Format - Conditional
Formatting) and use "expression is". In the condition put something
similar to "[Form]![control] is null" So, when it is null, the other
field should be disabled.

> I have a field in a form that I only want a user to input information in if
> another field is not null.  Does anyone know how?
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200608/1
Klatuu - 23 Aug 2006 20:13 GMT
Lets call the field you only want to allow input if the other field is not
null txtBox2, and the other field txtBox1.
Set the Locked property of txtBox2 to Yes in design view.
Then in the After Update event of txtBox1:

Me.txtBox2.Locked = IsNull(Me.txtBox1)

The same line of code should go in the form's Current event so it will
affect existing records:

If Not Me.NewRecord Then
   Me.txtBox2.Locked = IsNull(Me.txtBox1)
End If

> I have a field in a form that I only want a user to input information in if
> another field is not null.  Does anyone know how?
timglass - 24 Aug 2006 15:38 GMT
thanks i tried this and get an error that it can't find the me macro.  did I
miss something?

Thanks in advance for you help

>Lets call the field you only want to allow input if the other field is not
>null txtBox2, and the other field txtBox1.
[quoted text clipped - 12 lines]
>> I have a field in a form that I only want a user to input information in if
>> another field is not null.  Does anyone know how?
Klatuu - 24 Aug 2006 15:46 GMT
Where are you trying to do this?  Me is not a macro, it is a reference to the
current form.
If frmAnyForm is the current form, then
Me.MyText box
would be the same as
Forms!frmAnyForm!MyTextbox

> thanks i tried this and get an error that it can't find the me macro.  did I
> miss something?
[quoted text clipped - 17 lines]
> >> I have a field in a form that I only want a user to input information in if
> >> another field is not null.  Does anyone know how?
timglass - 24 Aug 2006 16:01 GMT
i put it in the on update line as you suggested and I get that error.  I then
change me to the actual form name zand still get the same error

>thanks i tried this and get an error that it can't find the me macro.  did I
>miss something?
[quoted text clipped - 6 lines]
>>> I have a field in a form that I only want a user to input information in if
>>> another field is not null.  Does anyone know how?
Klatuu - 24 Aug 2006 16:10 GMT
I am not sure you are putting it in the correct place.
Open the form in design view
Select the text box
Select Properties
Select the Events tab
Select the After Update event
Click on the command button to the right with the 3 dots on it
Select Code Builder
The VBA editor will appear
Put the code in here and change then names to match your controls.

> i put it in the on update line as you suggested and I get that error.  I then
> change me to the actual form name zand still get the same error
[quoted text clipped - 9 lines]
> >>> I have a field in a form that I only want a user to input information in if
> >>> another field is not null.  Does anyone know how?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.