PC Review


Reply
Thread Tools Rate Thread

Combo Box selection returns a Date() in another field

 
 
Flydianslip
Guest
Posts: n/a
 
      15th Mar 2010
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
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      15th Mar 2010
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" <(E-Mail Removed)> wrote in message
news:8E712838-EB87-452D-BA23-(E-Mail Removed)...
> 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



 
Reply With Quote
 
Flydianslip
Guest
Posts: n/a
 
      15th Mar 2010
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" wrote:

> 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" <(E-Mail Removed)> wrote in message
> news:8E712838-EB87-452D-BA23-(E-Mail Removed)...
> > 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

>
>
> .
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      15th Mar 2010
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
http://I.Am/DougSteele
(no e-mails, please!)



"Flydianslip" <(E-Mail Removed)> wrote in message
news:E47A96FC-187C-49CA-8219-(E-Mail Removed)...
> 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" wrote:
>
>> 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" <(E-Mail Removed)> wrote in message
>> news:8E712838-EB87-452D-BA23-(E-Mail Removed)...
>> > 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

>>
>>
>> .
>>


 
Reply With Quote
 
Flydianslip
Guest
Posts: n/a
 
      16th Mar 2010
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" wrote:

> 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
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
>
> "Flydianslip" <(E-Mail Removed)> wrote in message
> news:E47A96FC-187C-49CA-8219-(E-Mail Removed)...
> > 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" wrote:
> >
> >> 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" <(E-Mail Removed)> wrote in message
> >> news:8E712838-EB87-452D-BA23-(E-Mail Removed)...
> >> > 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
> >>
> >>
> >> .
> >>

>
> .
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      16th Mar 2010
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" <(E-Mail Removed)> wrote in message
news:84F07EFD-6BAC-4282-B151-(E-Mail Removed)...
> 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" wrote:
>
>> 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
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>>
>> "Flydianslip" <(E-Mail Removed)> wrote in message
>> news:E47A96FC-187C-49CA-8219-(E-Mail Removed)...
>> > 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" wrote:
>> >
>> >> 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" <(E-Mail Removed)> wrote in message
>> >> news:8E712838-EB87-452D-BA23-(E-Mail Removed)...
>> >> > 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
>> >>
>> >>
>> >> .
>> >>

>>
>> .
>>



 
Reply With Quote
 
Stuart McCall
Guest
Posts: n/a
 
      16th Mar 2010
"Flydianslip" <(E-Mail Removed)> wrote in message
news:84F07EFD-6BAC-4282-B151-(E-Mail Removed)...
> 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).


 
Reply With Quote
 
Flydianslip
Guest
Posts: n/a
 
      18th Mar 2010
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" wrote:

> 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" <(E-Mail Removed)> wrote in message
> news:84F07EFD-6BAC-4282-B151-(E-Mail Removed)...
> > 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" wrote:
> >
> >> 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
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >>
> >> "Flydianslip" <(E-Mail Removed)> wrote in message
> >> news:E47A96FC-187C-49CA-8219-(E-Mail Removed)...
> >> > 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" wrote:
> >> >
> >> >> 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" <(E-Mail Removed)> wrote in message
> >> >> news:8E712838-EB87-452D-BA23-(E-Mail Removed)...
> >> >> > 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
> >> >>
> >> >>
> >> >> .
> >> >>
> >>
> >> .
> >>

>
>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date stamp a combo box selection al.redeye Microsoft Access 2 3rd Apr 2008 09:48 AM
combo box selection to auto fill a second combo box (or field) MSA Microsoft Access Forms 1 28th Feb 2008 09:05 PM
Populate Combo Box selection to field DJ Notion via AccessMonster.com Microsoft Access Form Coding 2 20th Sep 2007 04:46 PM
Date in Field Returns Y for Yes =?Utf-8?B?SmFuZXRG?= Microsoft Access Queries 3 17th Aug 2005 05:30 PM
Re: Combo List selection returns position value, not actual list value Aladin Akyurek Microsoft Excel Worksheet Functions 0 11th Aug 2003 04:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:50 PM.