combobox set to a specific value based upon the text box

  • Thread starter Thread starter mpjm
  • Start date Start date
M

mpjm

i am trying to get a form to autoupdate whenever an employee leaves the
company. when the employee leaves, the "enddate" box is filled in with
their last day and a combo box is to be filled in saying "no" for
currently employed.

i am wondering how to get the combobox to automatically go to "no" when
the enddate is filled in and "yes" when the enddate is empty

any and all ideas/solutions/suggestions appreciated

thanks
 
Hi,



SELECT EmployeeName, EndDate Is Null As ActiveEmployee
FROM myTable


would do, I assume.



Hoping it may help,
Vanderghast, Access MVP
 
You could use the AfterUpdate event of the EndDate textbox:

Me![CurrentlyEmployed] = IsNull(Me![EndDate])

On the other hand, your CurrentlyEmployed field is redundant (and should not
be currently employed <g>)

You can easily tell if a person is currently employed by checking EndDate,
so you could for example add a calculated field to a query:

CurrentlyEmployed: IsNull([EndDate])

or perhaps better:

CurrentlyEmployed: IsNull([EndDate]) or [EndDate]>Date()
 
i tried using both, and neither one seems to work as of yet. i am going
to work with them a little and tweak them to my records. this would go
in the afterupdate box? the row source? which one? thanks


Graham said:
You could use the AfterUpdate event of the EndDate textbox:

Me![CurrentlyEmployed] = IsNull(Me![EndDate])

On the other hand, your CurrentlyEmployed field is redundant (and should not
be currently employed <g>)

You can easily tell if a person is currently employed by checking EndDate,
so you could for example add a calculated field to a query:

CurrentlyEmployed: IsNull([EndDate])

or perhaps better:

CurrentlyEmployed: IsNull([EndDate]) or [EndDate]>Date()

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

i am trying to get a form to autoupdate whenever an employee leaves the
company. when the employee leaves, the "enddate" box is filled in with
their last day and a combo box is to be filled in saying "no" for
currently employed.

i am wondering how to get the combobox to automatically go to "no" when
the enddate is filled in and "yes" when the enddate is empty

any and all ideas/solutions/suggestions appreciated

thanks
 
i got it working...just took some work (as usual!)...i used

Private Sub ENDDATE_AfterUpdate()
If IsNull(Me!ENDDATE) Or Len(Me!ENDDATE) < 1 Then
Me!CURRENT_EM = "Yes"
Else
Me!CURRENT_EM = "No"
End If
End Sub

in my enddate text box

thanks to all of you who lended a hand!

i tried using both, and neither one seems to work as of yet. i am going
to work with them a little and tweak them to my records. this would go
in the afterupdate box? the row source? which one? thanks


Graham said:
You could use the AfterUpdate event of the EndDate textbox:

Me![CurrentlyEmployed] = IsNull(Me![EndDate])

On the other hand, your CurrentlyEmployed field is redundant (and should not
be currently employed <g>)

You can easily tell if a person is currently employed by checking EndDate,
so you could for example add a calculated field to a query:

CurrentlyEmployed: IsNull([EndDate])

or perhaps better:

CurrentlyEmployed: IsNull([EndDate]) or [EndDate]>Date()

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

i am trying to get a form to autoupdate whenever an employee leaves the
company. when the employee leaves, the "enddate" box is filled in with
their last day and a combo box is to be filled in saying "no" for
currently employed.

i am wondering how to get the combobox to automatically go to "no" when
the enddate is filled in and "yes" when the enddate is empty

any and all ideas/solutions/suggestions appreciated

thanks
 
You mean you have a *text* field for CURRENT_EM? Why not make it a boolean
(Yes/No) field??

In fact, why not eliminate the problem (and the field) entirely and infer it
from the value of EndDate, as both Michel and I have suggested???
--
Graham Mandeno [Access MVP]
Auckland, New Zealand

i got it working...just took some work (as usual!)...i used

Private Sub ENDDATE_AfterUpdate()
If IsNull(Me!ENDDATE) Or Len(Me!ENDDATE) < 1 Then
Me!CURRENT_EM = "Yes"
Else
Me!CURRENT_EM = "No"
End If
End Sub

in my enddate text box

thanks to all of you who lended a hand!

i tried using both, and neither one seems to work as of yet. i am going
to work with them a little and tweak them to my records. this would go
in the afterupdate box? the row source? which one? thanks


Graham said:
You could use the AfterUpdate event of the EndDate textbox:

Me![CurrentlyEmployed] = IsNull(Me![EndDate])

On the other hand, your CurrentlyEmployed field is redundant (and
should not
be currently employed <g>)

You can easily tell if a person is currently employed by checking
EndDate,
so you could for example add a calculated field to a query:

CurrentlyEmployed: IsNull([EndDate])

or perhaps better:

CurrentlyEmployed: IsNull([EndDate]) or [EndDate]>Date()

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

i am trying to get a form to autoupdate whenever an employee leaves
the
company. when the employee leaves, the "enddate" box is filled in
with
their last day and a combo box is to be filled in saying "no" for
currently employed.

i am wondering how to get the combobox to automatically go to "no"
when
the enddate is filled in and "yes" when the enddate is empty

any and all ideas/solutions/suggestions appreciated

thanks
 
what i did was set the combo box afterupdate event procedure to the
code i provided, which changes the combo box to either yes or no
depending if enddate has a date in it or not


Graham said:
You mean you have a *text* field for CURRENT_EM? Why not make it a boolean
(Yes/No) field??

In fact, why not eliminate the problem (and the field) entirely and infer it
from the value of EndDate, as both Michel and I have suggested???
--
Graham Mandeno [Access MVP]
Auckland, New Zealand

i got it working...just took some work (as usual!)...i used

Private Sub ENDDATE_AfterUpdate()
If IsNull(Me!ENDDATE) Or Len(Me!ENDDATE) < 1 Then
Me!CURRENT_EM = "Yes"
Else
Me!CURRENT_EM = "No"
End If
End Sub

in my enddate text box

thanks to all of you who lended a hand!

i tried using both, and neither one seems to work as of yet. i am going
to work with them a little and tweak them to my records. this would go
in the afterupdate box? the row source? which one? thanks


Graham Mandeno wrote:
You could use the AfterUpdate event of the EndDate textbox:

Me![CurrentlyEmployed] = IsNull(Me![EndDate])

On the other hand, your CurrentlyEmployed field is redundant (and
should not
be currently employed <g>)

You can easily tell if a person is currently employed by checking
EndDate,
so you could for example add a calculated field to a query:

CurrentlyEmployed: IsNull([EndDate])

or perhaps better:

CurrentlyEmployed: IsNull([EndDate]) or [EndDate]>Date()

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

i am trying to get a form to autoupdate whenever an employee leaves
the
company. when the employee leaves, the "enddate" box is filled in
with
their last day and a combo box is to be filled in saying "no" for
currently employed.

i am wondering how to get the combobox to automatically go to "no"
when
the enddate is filled in and "yes" when the enddate is empty

any and all ideas/solutions/suggestions appreciated

thanks
 
Back
Top