Yes Gina, the Terminated form field has a little arrow to select from a
list.
So it is a combo box. Sorry for the mix up in terminology...I'm new to
this.
Bob
:
Selection LIst? You mean it's NOT a combo box? Combo Box has a
little
arrow where you select from a list.
Bound Column: 1
Column Count: 1
Row Source: Yes;No
Row Source Type: Value List
I'm not sure what you mean by combo box. But on the form, Terminated
is
a
selection list w/either a value of No or Yes. So I guess the correct
answer
to your first question is 2 rows.
:
Okay but at least we now know the code is being read! Your combo
box,
is
that a single row not 2 row
1;Yes
2;No
and the bound column is 1?
Please look at the Property Window of Terminated, what you should
see
is
Column Count = 1 and Bound Column = 1 and Row Source = Yes;No and
Row
Source
Type = Value List.
Gina,
A pop-up msg appeared that said "No, I don't work!". That was
cool.
But
obviously I still have a problem.
Bob
:
Please try pasting the below code and then change the combo box.
Does
a
message come up?
If Me.Terminated = "Yes" Then
'Me.[Expiry Date] = Date
MsgBox "Yes, I work!", vbOkOnly, "Test"
Else
MsgBox "No, I don't work!", vbOkOnly, "Test"
End If
Gina,
I replied to your post but it looks like it didn't take. So
here's
another
post.
First of all...thanks for your help...but my Date field is
still
not
populating.
I'm using MS Access 2002.
In Design View, I right-clicked on the Terminated Field,
selected
Properties, then scrolled down to After Update and clicked on
the
drop-down
arrow. There was only one choice; [Event Procedure]. I
selected
this
then
clicked on the elipses button to the right. A windows opened
and
I
pasted
my
code just below the "Private Sub Terminated_AfterUpdate()" and
did a
save.
Here's a copy of my code:
Private Sub Terminated_AfterUpdate()
If Me.[Terminated] = "Yes" Then
Me.[Expiry Date] = Date
End If
End Sub
Thanks again,
Bob
:
My 2 cents worth...
You said you went to ' form's Terminated field in Design View
then
'
(you
just want to make sure it's not on the After Update of the
form
because
it
needs to be on the After Update of the control)
Okay not sure the code is in the correct place, so just check
1. Go to Design View on the form
2. Go click on you field ' Terminated ' and then right mouse
click
if
Properties Window for your field is not showing and select
Properties.
3. In the Properties Window for your field scroll down till
you
find
the
After Update Event and select ... Build Event
4. Place your code, close and save. Try it, if that does not
work
post
back.
If you have already done the above "NEVERMIND"
The () after Date sometime disappears on mine to, still does
wht
it's
suppose to.
Gina
choice Build Event"SkyGuy"
<
[email protected]>
wrote
in
message
Ok Ed...I right-clicked on the form's Terminated field in
Design
View
then
choice Build Event. I then chose "After Update" from the
drop-down
list
in
Visual Basic. But when I do a save Visual Basic eliminates
the
()
after
=Date
and the solution does not work. What am I doing
wrong...thanks.
:
OK, just change it to:
If Me.[Terminated] = "Yes" Then
Me.[Expiration Date] = Date()
End if
message
I apologize Ed...Terminated is not a Checkbox. It's a
Selection
List
with
either a value of Yes or No. So if I select Yes in
Terminated
I
want
the
Experiation field to be populated with today's date.
Again,
sorry
for
the
initial misinformation.
Bob
:
In the AfterUpdate event of your checkbox, put:
If Me.[Terminated] = -1 then
Me.[Expiration Date] = Date()
End if
-Ed
message
Hello,
I'm new to Access and not familiar with Events,
Procedures
or
Visual
Basic.
I have a form with a Date Field called "Expiration
Date".
In
the
same
form
I
have a Checkbox called "Terminated".
I'd like the current date to automatically populate
the
Expiration
Date
when
Terminated is checked.
Any help would be very much appreciated.
Thanks,
Bob