Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Feb 2003
    Location
    England
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding a value to a field from a list box (Access 2000)

    Can anyone tell me what is wrong with this code?

    Private Sub fmTopic_Change()
    [TimeTable]. <img src=/S/time.gif border=0 alt=time width=23 height=39> = Me.[fmTopic].[Column](2)
    End Sub

    TimeTable is a table
    Time is a field in the timetable table
    fmTopic is a listbox in a form.

    It is supposed to put data it gets from on of the columns in the lookup from the listbox and place it in the Time field.

    I am not very good at coding, so any help please use simple words.

  2. #2
    New Lounger
    Join Date
    Feb 2003
    Location
    England
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding a value to a field from a list box (Access 2000)

    the hourglass should be [ time ] and part of the script. in the script it does not have spaces inside the brackets (but when I tried to show this I got the Hourglass)

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adding a value to a field from a list box (Access 2000)

    The reason that you got the hourglass is that the Lounge uses square brackets to insert special codes such as hyperlinks and smilies into a post. You happened to use the code for the <!t>[Time]<!/t> smilie. There is a trick to avoid this: use <!t>[t]<!/t> to insert an opening bracket, and <!t>[/t]<!/t> to insert a closing bracket; of course, this is only necessary in cases such as you encountered.

    Is the form that contains fmTopic bound to TimeTable? I.e. is TimeTable, or a query based on TimeTable, the Record Source of the form?
    If so, you can omit [TimeTable].:

    <!t>[Time]<!/t> = Me.[fmTopic].[Column](2)

    If not, you'll have to do more work to store the value in the table. Post back if that is the case.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Adding a value to a field from a list box (Access 2000)

    Just as an aside, Time is not a good field name to use in Access because it is the name of a VBA DateTime property.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •