enable/disable feild

G

Guest

I am trying to enable/disable a feild based on inputs from another field. To
be more specific, I have a two fields on this form. One is called "Status"
and the other is called "Date Closed". The Status field is a drop down list
with the choice of Active or Closed. When Closed is selected, I want the
current date to populate the "Date Closed" field. I would also like the
"Date Closed" field to become disabled so changes cannot be made to it. How
in the world do I do this?
 
B

Brian Bastl

What is the rowsource for Status? Does it include the PK, or is it a single
column?
If the latter, then using the AfterUpdate event for Status,
If Me.Status = "Closed" Then
Me.[Date Closed] = Date
Me.[Date Closed].Enabled = False
End if

HTH,
Brian
 
G

Guest

Thanks. It works so I guess the latter applied. One other issue. If the
Status in then changed back to "Active", how do I enable the Closed Date?
--
Hlewis


Brian Bastl said:
What is the rowsource for Status? Does it include the PK, or is it a single
column?
If the latter, then using the AfterUpdate event for Status,
If Me.Status = "Closed" Then
Me.[Date Closed] = Date
Me.[Date Closed].Enabled = False
End if

HTH,
Brian


Hlewis said:
I am trying to enable/disable a feild based on inputs from another field. To
be more specific, I have a two fields on this form. One is called "Status"
and the other is called "Date Closed". The Status field is a drop down list
with the choice of Active or Closed. When Closed is selected, I want the
current date to populate the "Date Closed" field. I would also like the
"Date Closed" field to become disabled so changes cannot be made to it. How
in the world do I do this?
 
B

Brian Bastl

You could use a "Select Case" statement in the After Update event for
Status.

Private Sub Status_AfterUpdate()

Select Case Status

Case "Active"
'your code if active

Case "Closed"
'your code if closed

End Select

End Sub

HTH,
Brian


Hlewis said:
Thanks. It works so I guess the latter applied. One other issue. If the
Status in then changed back to "Active", how do I enable the Closed Date?
--
Hlewis


Brian Bastl said:
What is the rowsource for Status? Does it include the PK, or is it a single
column?
If the latter, then using the AfterUpdate event for Status,
If Me.Status = "Closed" Then
Me.[Date Closed] = Date
Me.[Date Closed].Enabled = False
End if

HTH,
Brian


Hlewis said:
I am trying to enable/disable a feild based on inputs from another
field.
To
be more specific, I have a two fields on this form. One is called "Status"
and the other is called "Date Closed". The Status field is a drop
down
list
with the choice of Active or Closed. When Closed is selected, I want the
current date to populate the "Date Closed" field. I would also like the
"Date Closed" field to become disabled so changes cannot be made to
it.
How
in the world do I do this?
 
G

Guest

Brian,
I'm still have issues with this. The code you provided works perfectly for
the specific record I'm working on. The problem is, when I go to the next
record, the Status is "Active", but the Date Closed field is disabled. How
can I have this code work on each individual record. Just so you know, the
Status is defaulted to "Active" for each record.
--
Hlewis


Brian Bastl said:
You could use a "Select Case" statement in the After Update event for
Status.

Private Sub Status_AfterUpdate()

Select Case Status

Case "Active"
'your code if active

Case "Closed"
'your code if closed

End Select

End Sub

HTH,
Brian


Hlewis said:
Thanks. It works so I guess the latter applied. One other issue. If the
Status in then changed back to "Active", how do I enable the Closed Date?
--
Hlewis


Brian Bastl said:
What is the rowsource for Status? Does it include the PK, or is it a single
column?
If the latter, then using the AfterUpdate event for Status,
If Me.Status = "Closed" Then
Me.[Date Closed] = Date
Me.[Date Closed].Enabled = False
End if

HTH,
Brian


I am trying to enable/disable a feild based on inputs from another field.
To
be more specific, I have a two fields on this form. One is called
"Status"
and the other is called "Date Closed". The Status field is a drop down
list
with the choice of Active or Closed. When Closed is selected, I want the
current date to populate the "Date Closed" field. I would also like the
"Date Closed" field to become disabled so changes cannot be made to it.
How
in the world do I do this?
 
B

Brian Bastl

you'll need use your form's On Current event procedure to set the Enabled
property for Date Closed to True. You might try the following:

Private Sub Form_Current()

Me.[Date Closed].Enabled = (Me.Status <> "Closed")

End Sub

This should enable [Date Closed] for any new records and existing records
where Status = "Active"

HTH,
Brian


Hlewis said:
Brian,
I'm still have issues with this. The code you provided works perfectly for
the specific record I'm working on. The problem is, when I go to the next
record, the Status is "Active", but the Date Closed field is disabled. How
can I have this code work on each individual record. Just so you know, the
Status is defaulted to "Active" for each record.
--
Hlewis


Brian Bastl said:
You could use a "Select Case" statement in the After Update event for
Status.

Private Sub Status_AfterUpdate()

Select Case Status

Case "Active"
'your code if active

Case "Closed"
'your code if closed

End Select

End Sub

HTH,
Brian


Hlewis said:
Thanks. It works so I guess the latter applied. One other issue. If the
Status in then changed back to "Active", how do I enable the Closed Date?
--
Hlewis


:

What is the rowsource for Status? Does it include the PK, or is it a single
column?
If the latter, then using the AfterUpdate event for Status,
If Me.Status = "Closed" Then
Me.[Date Closed] = Date
Me.[Date Closed].Enabled = False
End if

HTH,
Brian


I am trying to enable/disable a feild based on inputs from another field.
To
be more specific, I have a two fields on this form. One is called
"Status"
and the other is called "Date Closed". The Status field is a drop down
list
with the choice of Active or Closed. When Closed is selected, I
want
the
current date to populate the "Date Closed" field. I would also
like
the
"Date Closed" field to become disabled so changes cannot be made
to
it.
How
in the world do I do this?
 
G

Guest

That seems to have done the job. Thanks.
--
Hlewis


Brian Bastl said:
you'll need use your form's On Current event procedure to set the Enabled
property for Date Closed to True. You might try the following:

Private Sub Form_Current()

Me.[Date Closed].Enabled = (Me.Status <> "Closed")

End Sub

This should enable [Date Closed] for any new records and existing records
where Status = "Active"

HTH,
Brian


Hlewis said:
Brian,
I'm still have issues with this. The code you provided works perfectly for
the specific record I'm working on. The problem is, when I go to the next
record, the Status is "Active", but the Date Closed field is disabled. How
can I have this code work on each individual record. Just so you know, the
Status is defaulted to "Active" for each record.
--
Hlewis


Brian Bastl said:
You could use a "Select Case" statement in the After Update event for
Status.

Private Sub Status_AfterUpdate()

Select Case Status

Case "Active"
'your code if active

Case "Closed"
'your code if closed

End Select

End Sub

HTH,
Brian


Thanks. It works so I guess the latter applied. One other issue. If the
Status in then changed back to "Active", how do I enable the Closed Date?
--
Hlewis


:

What is the rowsource for Status? Does it include the PK, or is it a
single
column?
If the latter, then using the AfterUpdate event for Status,
If Me.Status = "Closed" Then
Me.[Date Closed] = Date
Me.[Date Closed].Enabled = False
End if

HTH,
Brian


I am trying to enable/disable a feild based on inputs from another
field.
To
be more specific, I have a two fields on this form. One is called
"Status"
and the other is called "Date Closed". The Status field is a drop
down
list
with the choice of Active or Closed. When Closed is selected, I want
the
current date to populate the "Date Closed" field. I would also like
the
"Date Closed" field to become disabled so changes cannot be made to
it.
How
in the world do I do this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top