Text field updates froma list box

  • Thread starter John Chamberlain
  • Start date
J

John Chamberlain

Looking for a way to have a text box updated with a date
(todays date)by clicking a particular item in a list box.
Each item in the list box already has an ID code assigned
 
V

Vítor Barbosa

Hi,

I think this is what you need:

On list box afterupdate event write this:

' ******* code *************

Private Sub lstListBoxName_AfterUpdate ()
Dim intYourID as Integer

intYourID = 1 ' example

If lstListBoxName.Value = intYourID then
Me.txtTodaysDate.Value = Format(Now(), "Short Date")
End If

End Sub
**** code end***************

Hope it helps,

Vítor Barbosa
 
L

Larry Linson

In the AfterUpdate event of the ListBox,

Me!txtMyDateControl = Date()

This assumes, of course, that the value selected in the ListBox is not
germane to the date you save -- e.g., that you are simply saving the date
that something was updated by selecting it in the ListBox.

Larry Linson
Microsoft Access MVP
 
J

John_chamberlain

O.K. for clarification. If I choose item 9 from a list of
ten items in the list box I want to put the Curent Date
in a text box called "Approved" on the same form. If I
choose any other item in the list box nothing happens to
the "Approved" text box.

John
 

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