A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Disable text box via Combo box



 
 
Thread Tools Display Modes
  #1  
Old September 27th, 2006, 04:02 PM posted to microsoft.public.access.forms
Kurt_Cobain67
external usenet poster
 
Posts: 3
Default Disable text box via Combo box

Hey,
Can any one see if that can help?

I want to disable certain fields when a certain value is selected in a
combo box.
I have a form called "Expenses" and within that a subform
"GeneralExpenses_subform". On the subform form when you select a value
other than "Mileage" from the combo box "ExpenseType" i want
"VisitMileage","VehicleMileage" and "MileageRate" to be disabled so
that no data can be written in to them on that particluar record.

Cheers

Nathan

  #2  
Old September 27th, 2006, 05:23 PM posted to microsoft.public.access.forms
Al Campagna
external usenet poster
 
Posts: 421
Default Disable text box via Combo box

Kurt,
On the AfterUpdate event of cboExpenseType...

Refresh
VisitMileage.Enabled = cboExpenseType = "Mileage"
MileageRate. Enabled = cboExpenseType = "Mileage"
VehicleMileage.Enabled = cboExpenseType = "Mileage"

Since that will set those fields Enabled/Disabled on EACH subform record, use the same
code in the subform record OnCurrent event.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


"Kurt_Cobain67" wrote in message
s.com...
Hey,
Can any one see if that can help?

I want to disable certain fields when a certain value is selected in a
combo box.
I have a form called "Expenses" and within that a subform
"GeneralExpenses_subform". On the subform form when you select a value
other than "Mileage" from the combo box "ExpenseType" i want
"VisitMileage","VehicleMileage" and "MileageRate" to be disabled so
that no data can be written in to them on that particluar record.

Cheers

Nathan



  #3  
Old September 28th, 2006, 02:09 PM posted to microsoft.public.access.forms
Kurt_Cobain67
external usenet poster
 
Posts: 3
Default Disable text box via Combo box

Cheers for that.

I have pasted the code in to AfterUpdate on the combo box and on the
subform in OnCurrent, but the feilds are disabled all thetime no matter
what i select.

Nathan

  #4  
Old September 28th, 2006, 02:50 PM posted to microsoft.public.access.forms
Al Campagna
external usenet poster
 
Posts: 421
Default Disable text box via Combo box

Please provide the code, exactly as you used it...
I'll test my solution in the meantime...
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"Kurt_Cobain67" wrote in message
ups.com...
Cheers for that.

I have pasted the code in to AfterUpdate on the combo box and on the
subform in OnCurrent, but the feilds are disabled all thetime no matter
what i select.

Nathan



  #5  
Old September 28th, 2006, 03:26 PM posted to microsoft.public.access.forms
Al Campagna
external usenet poster
 
Posts: 421
Default Disable text box via Combo box

Kurt,
Please don't delete any threads from our previous posts. It's convenvenient to see my,
and your, past reponses as we continue the problem determination.
Let's try a more obvious method...

On the combo AfterUpdate event... (use your own field names... I used my own for ex.)
If Service = "Design" Then
WorkDescription.Enabled = False
Else
WorkDescription.Enabled = True
End If

On the subform On Current event
If IsNull(Service) Or Service "Design" Then
WorkDescription.Enabled = True
Else
WorkDescription.Enabled = False
End If

I tested this, and it works.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"Kurt_Cobain67" wrote in message
ups.com...
Cheers for that.

I have pasted the code in to AfterUpdate on the combo box and on the
subform in OnCurrent, but the feilds are disabled all thetime no matter
what i select.

Nathan



  #6  
Old September 28th, 2006, 04:09 PM posted to microsoft.public.access.forms
Al Campagna
external usenet poster
 
Posts: 421
Default Disable text box via Combo box

Just happen to notice a typo... that initial code should have been.
VisitMileage.Enabled = cboExpenseType "Mileage" (not equal rather than equal)
MileageRate. Enabled = cboExpenseType "Mileage"
VehicleMileage.Enabled = cboExpenseType "Mileage"

If you still have problems, try my later posted code. I tested that.
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"Al Campagna" wrote in message
...
Kurt,
On the AfterUpdate event of cboExpenseType...

Refresh
VisitMileage.Enabled = cboExpenseType = "Mileage"
MileageRate. Enabled = cboExpenseType = "Mileage"
VehicleMileage.Enabled = cboExpenseType = "Mileage"

Since that will set those fields Enabled/Disabled on EACH subform record, use the same
code in the subform record OnCurrent event.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


"Kurt_Cobain67" wrote in message
s.com...
Hey,
Can any one see if that can help?

I want to disable certain fields when a certain value is selected in a
combo box.
I have a form called "Expenses" and within that a subform
"GeneralExpenses_subform". On the subform form when you select a value
other than "Mileage" from the combo box "ExpenseType" i want
"VisitMileage","VehicleMileage" and "MileageRate" to be disabled so
that no data can be written in to them on that particluar record.

Cheers

Nathan





  #7  
Old September 29th, 2006, 09:10 AM posted to microsoft.public.access.forms
Kurt_Cobain67
external usenet poster
 
Posts: 3
Default Disable text box via Combo box


Al Campagna wrote:
Kurt,
Please don't delete any threads from our previous posts. It's convenvenient to see my,
and your, past reponses as we continue the problem determination.
Let's try a more obvious method...

On the combo AfterUpdate event... (use your own field names... I used my own for ex.)
If Service = "Design" Then
WorkDescription.Enabled = False
Else
WorkDescription.Enabled = True
End If

On the subform On Current event
If IsNull(Service) Or Service "Design" Then
WorkDescription.Enabled = True
Else
WorkDescription.Enabled = False
End If

I tested this, and it works.


Hey, this works but it enables and disables all of the previous cells
in the record, i want it to disabled and enable the cells in each
individual record, not the whole table.

Cheers

Kurt

  #8  
Old September 29th, 2006, 02:31 PM posted to microsoft.public.access.forms
Al Campagna
external usenet poster
 
Posts: 421
Default Disable text box via Combo box

Such is the nature of forms.
If you changed the color for one field, all records would have that field color.
Any change to a field on a continuous subform or single form is "visibly" applied to
all records.
But... it's the same for single forms. Disable a field and all rceords have that field
disabled... it's just that you don't see the other records in Single like you do in
Continuous. Of course, as you move from record to record, the code enables/disables as
you get there, so it "appears" as though each record has it's "own" disable/enable.

You could use Locking instead, then the "appearance" of the field would not change so
obviously.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


"Kurt_Cobain67" wrote in message
ups.com...

Al Campagna wrote:
Kurt,
Please don't delete any threads from our previous posts. It's convenvenient to see
my,
and your, past reponses as we continue the problem determination.
Let's try a more obvious method...

On the combo AfterUpdate event... (use your own field names... I used my own for ex.)
If Service = "Design" Then
WorkDescription.Enabled = False
Else
WorkDescription.Enabled = True
End If

On the subform On Current event
If IsNull(Service) Or Service "Design" Then
WorkDescription.Enabled = True
Else
WorkDescription.Enabled = False
End If

I tested this, and it works.


Hey, this works but it enables and disables all of the previous cells
in the record, i want it to disabled and enable the cells in each
individual record, not the whole table.

Cheers

Kurt



 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:42 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.