Combo Box selection returns a Date() in another field

F

Flydianslip

Can anyone help me?
I had this figured out in MS Access 2003 but now I'm working in 2007 and my
previous code doesnt work.

I have a form in which I have a Combo Box named "Status1" and the Control
Source is "Status". The Row Source is "Pending";"Active";"On
Hold";"Completed".
Type is Value List.

I also have a field named "completed" who's Control Source is "Date Completed"

I want a AfterUpdate when the Combo Box is set to "Completed" the Date
Completed fills in todays date. But when the Combo Box is anything else it
just leaves the Date Completed blank or null.
Thank you for any help.

This is what I have so far but it doesnt work.

Private Sub Status1_AfterUpdate()
If Me.Status1 = "Completed" Then
Me.[Date Completed] = Date
Else
Me.[Date Completed] = Null
End If
End Sub
 
D

Douglas J. Steele

What does "doesnt work" mean in this context? The code you've posted looks
as though it should work.

Can you verify that the code is, in fact, being called? Can you verify that
referring to Me.Status1 when the word "Completed" is selected in the combo
box does result in "Completed"?
 
F

Flydianslip

My 2003 code which filled in today's date within a certian field when the
combo box was selected as "Completed" doesnt work in 2007.

I've learned just enough to do what I want Access to do by reading forums,
but this is frustrating me. I can't seem to get this to work anymore since
going to 2007... When I select "Completed" in the combo box the other field
doesnt return anything it just remains blank.

I can verfiy that when "Completed" is selected in the Combo Box in the Form
that the field "Status" in the Table reflects this. I'm not sure how to make
sure that the code is being called how can I do that?

Douglas J. Steele said:
What does "doesnt work" mean in this context? The code you've posted looks
as though it should work.

Can you verify that the code is, in fact, being called? Can you verify that
referring to Me.Status1 when the word "Completed" is selected in the combo
box does result in "Completed"?

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

Flydianslip said:
Can anyone help me?
I had this figured out in MS Access 2003 but now I'm working in 2007 and
my
previous code doesnt work.

I have a form in which I have a Combo Box named "Status1" and the Control
Source is "Status". The Row Source is "Pending";"Active";"On
Hold";"Completed".
Type is Value List.

I also have a field named "completed" who's Control Source is "Date
Completed"

I want a AfterUpdate when the Combo Box is set to "Completed" the Date
Completed fills in todays date. But when the Combo Box is anything else it
just leaves the Date Completed blank or null.
Thank you for any help.

This is what I have so far but it doesnt work.

Private Sub Status1_AfterUpdate()
If Me.Status1 = "Completed" Then
Me.[Date Completed] = Date
Else
Me.[Date Completed] = Null
End If
End Sub


.
 
D

Douglas J. Steele

You can put a break point in the code so that execution will halt and you're
be taken there during execution, or you could simply put a message box into
the code until you know it's executing (at which point you'd remove the
message box)

I'm not sure I understand what you mean by "I can verfiy that when
'Completed' is selected in the Combo Box in the Form that the field 'Status'
in the Table reflects this." Are you saying that the combo box is bound to
the field Status, and the value of the field is updated to reflect the
selection from the combo box?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Flydianslip said:
My 2003 code which filled in today's date within a certian field when the
combo box was selected as "Completed" doesnt work in 2007.

I've learned just enough to do what I want Access to do by reading forums,
but this is frustrating me. I can't seem to get this to work anymore since
going to 2007... When I select "Completed" in the combo box the other
field
doesnt return anything it just remains blank.

I can verfiy that when "Completed" is selected in the Combo Box in the
Form
that the field "Status" in the Table reflects this. I'm not sure how to
make
sure that the code is being called how can I do that?

Douglas J. Steele said:
What does "doesnt work" mean in this context? The code you've posted
looks
as though it should work.

Can you verify that the code is, in fact, being called? Can you verify
that
referring to Me.Status1 when the word "Completed" is selected in the
combo
box does result in "Completed"?

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

Flydianslip said:
Can anyone help me?
I had this figured out in MS Access 2003 but now I'm working in 2007
and
my
previous code doesnt work.

I have a form in which I have a Combo Box named "Status1" and the
Control
Source is "Status". The Row Source is "Pending";"Active";"On
Hold";"Completed".
Type is Value List.

I also have a field named "completed" who's Control Source is "Date
Completed"

I want a AfterUpdate when the Combo Box is set to "Completed" the Date
Completed fills in todays date. But when the Combo Box is anything else
it
just leaves the Date Completed blank or null.
Thank you for any help.

This is what I have so far but it doesnt work.

Private Sub Status1_AfterUpdate()
If Me.Status1 = "Completed" Then
Me.[Date Completed] = Date
Else
Me.[Date Completed] = Null
End If
End Sub


.
 
F

Flydianslip

I'm not sure what you mean about putting in a breakpoint. I see how to add a
breakpoint but it doesnt do anything. Can you give me some kinda hint? I'm
actually quite new to this. Thank you.

And yes the combo box is bound to a field named Status and the field is
update to reflect what the current status is.

Douglas J. Steele said:
You can put a break point in the code so that execution will halt and you're
be taken there during execution, or you could simply put a message box into
the code until you know it's executing (at which point you'd remove the
message box)

I'm not sure I understand what you mean by "I can verfiy that when
'Completed' is selected in the Combo Box in the Form that the field 'Status'
in the Table reflects this." Are you saying that the combo box is bound to
the field Status, and the value of the field is updated to reflect the
selection from the combo box?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Flydianslip said:
My 2003 code which filled in today's date within a certian field when the
combo box was selected as "Completed" doesnt work in 2007.

I've learned just enough to do what I want Access to do by reading forums,
but this is frustrating me. I can't seem to get this to work anymore since
going to 2007... When I select "Completed" in the combo box the other
field
doesnt return anything it just remains blank.

I can verfiy that when "Completed" is selected in the Combo Box in the
Form
that the field "Status" in the Table reflects this. I'm not sure how to
make
sure that the code is being called how can I do that?

Douglas J. Steele said:
What does "doesnt work" mean in this context? The code you've posted
looks
as though it should work.

Can you verify that the code is, in fact, being called? Can you verify
that
referring to Me.Status1 when the word "Completed" is selected in the
combo
box does result in "Completed"?

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

Can anyone help me?
I had this figured out in MS Access 2003 but now I'm working in 2007
and
my
previous code doesnt work.

I have a form in which I have a Combo Box named "Status1" and the
Control
Source is "Status". The Row Source is "Pending";"Active";"On
Hold";"Completed".
Type is Value List.

I also have a field named "completed" who's Control Source is "Date
Completed"

I want a AfterUpdate when the Combo Box is set to "Completed" the Date
Completed fills in todays date. But when the Combo Box is anything else
it
just leaves the Date Completed blank or null.
Thank you for any help.

This is what I have so far but it doesnt work.

Private Sub Status1_AfterUpdate()
If Me.Status1 = "Completed" Then
Me.[Date Completed] = Date
Else
Me.[Date Completed] = Null
End If
End Sub


.

.
 
D

Douglas J. Steele

If you added a breakpoint and nothing happened, that implies that the code
isn't being called.

Try the alternative approach I suggested (putting a message box into the
code) to be sure.

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

Flydianslip said:
I'm not sure what you mean about putting in a breakpoint. I see how to add
a
breakpoint but it doesnt do anything. Can you give me some kinda hint? I'm
actually quite new to this. Thank you.

And yes the combo box is bound to a field named Status and the field is
update to reflect what the current status is.

Douglas J. Steele said:
You can put a break point in the code so that execution will halt and
you're
be taken there during execution, or you could simply put a message box
into
the code until you know it's executing (at which point you'd remove the
message box)

I'm not sure I understand what you mean by "I can verfiy that when
'Completed' is selected in the Combo Box in the Form that the field
'Status'
in the Table reflects this." Are you saying that the combo box is bound
to
the field Status, and the value of the field is updated to reflect the
selection from the combo box?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Flydianslip said:
My 2003 code which filled in today's date within a certian field when
the
combo box was selected as "Completed" doesnt work in 2007.

I've learned just enough to do what I want Access to do by reading
forums,
but this is frustrating me. I can't seem to get this to work anymore
since
going to 2007... When I select "Completed" in the combo box the other
field
doesnt return anything it just remains blank.

I can verfiy that when "Completed" is selected in the Combo Box in the
Form
that the field "Status" in the Table reflects this. I'm not sure how to
make
sure that the code is being called how can I do that?

:

What does "doesnt work" mean in this context? The code you've posted
looks
as though it should work.

Can you verify that the code is, in fact, being called? Can you verify
that
referring to Me.Status1 when the word "Completed" is selected in the
combo
box does result in "Completed"?

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

Can anyone help me?
I had this figured out in MS Access 2003 but now I'm working in 2007
and
my
previous code doesnt work.

I have a form in which I have a Combo Box named "Status1" and the
Control
Source is "Status". The Row Source is "Pending";"Active";"On
Hold";"Completed".
Type is Value List.

I also have a field named "completed" who's Control Source is "Date
Completed"

I want a AfterUpdate when the Combo Box is set to "Completed" the
Date
Completed fills in todays date. But when the Combo Box is anything
else
it
just leaves the Date Completed blank or null.
Thank you for any help.

This is what I have so far but it doesnt work.

Private Sub Status1_AfterUpdate()
If Me.Status1 = "Completed" Then
Me.[Date Completed] = Date
Else
Me.[Date Completed] = Null
End If
End Sub


.

.
 
S

Stuart McCall

Flydianslip said:
I'm not sure what you mean about putting in a breakpoint. I see how to add
a
breakpoint but it doesnt do anything. Can you give me some kinda hint? I'm
actually quite new to this. Thank you.
<snip>

The way to use breakpoints:

Place a breakpoint on a code line. Run the app (F5). When the code attempts
to execute your marked code line, the VBA environment will halt code
execution, allowing you to inspect the contents of variables and single-step
through the code (Google if you need an explanation of single-stepping).
 
F

Flydianslip

Thank you I finally figured it out, my IT department kept requiring me to
turn on macros and VBA scripts and it was messing me up. It works like it
should now.
I'm going to open another thread on another question. "How to require a
field (disallow null or allow null) depending on the selection of another
combobox."
Any ideas?

Douglas J. Steele said:
If you added a breakpoint and nothing happened, that implies that the code
isn't being called.

Try the alternative approach I suggested (putting a message box into the
code) to be sure.

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

Flydianslip said:
I'm not sure what you mean about putting in a breakpoint. I see how to add
a
breakpoint but it doesnt do anything. Can you give me some kinda hint? I'm
actually quite new to this. Thank you.

And yes the combo box is bound to a field named Status and the field is
update to reflect what the current status is.

Douglas J. Steele said:
You can put a break point in the code so that execution will halt and
you're
be taken there during execution, or you could simply put a message box
into
the code until you know it's executing (at which point you'd remove the
message box)

I'm not sure I understand what you mean by "I can verfiy that when
'Completed' is selected in the Combo Box in the Form that the field
'Status'
in the Table reflects this." Are you saying that the combo box is bound
to
the field Status, and the value of the field is updated to reflect the
selection from the combo box?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



My 2003 code which filled in today's date within a certian field when
the
combo box was selected as "Completed" doesnt work in 2007.

I've learned just enough to do what I want Access to do by reading
forums,
but this is frustrating me. I can't seem to get this to work anymore
since
going to 2007... When I select "Completed" in the combo box the other
field
doesnt return anything it just remains blank.

I can verfiy that when "Completed" is selected in the Combo Box in the
Form
that the field "Status" in the Table reflects this. I'm not sure how to
make
sure that the code is being called how can I do that?

:

What does "doesnt work" mean in this context? The code you've posted
looks
as though it should work.

Can you verify that the code is, in fact, being called? Can you verify
that
referring to Me.Status1 when the word "Completed" is selected in the
combo
box does result in "Completed"?

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

Can anyone help me?
I had this figured out in MS Access 2003 but now I'm working in 2007
and
my
previous code doesnt work.

I have a form in which I have a Combo Box named "Status1" and the
Control
Source is "Status". The Row Source is "Pending";"Active";"On
Hold";"Completed".
Type is Value List.

I also have a field named "completed" who's Control Source is "Date
Completed"

I want a AfterUpdate when the Combo Box is set to "Completed" the
Date
Completed fills in todays date. But when the Combo Box is anything
else
it
just leaves the Date Completed blank or null.
Thank you for any help.

This is what I have so far but it doesnt work.

Private Sub Status1_AfterUpdate()
If Me.Status1 = "Completed" Then
Me.[Date Completed] = Date
Else
Me.[Date Completed] = Null
End If
End Sub


.


.


.
 

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