Text field updates froma list box

  • Thread starter Thread starter John Chamberlain
  • Start date 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
 
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
 
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
 
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
 
Back
Top