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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Adding a value to a field from a list box (Access 2000)

    Author
    Topic
    #390767

    Can anyone tell me what is wrong with this code?

    Private Sub fmTopic_Change()
    [TimeTable]. time = 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.

    Viewing 1 reply thread
    Author
    Replies
    • #695409

      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)

      • #695446

        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.

    • #695418

      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 [Time] smilie. There is a trick to avoid this: use [t] to insert an opening bracket, and [/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].:

      [Time] = 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.

    Viewing 1 reply thread
    Reply To: Adding a value to a field from a list box (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: