Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005

    Unanswered: Passing a Parameter for a Field Name

    I have a recordset, rstStudentData, in which I want to see the contents of a particular field. The particular field is in column 1 of the item that is selected in a list box, lstAreaTopic. What is the syntax for doing that?
    I have tried the following code:

    strFieldText = rstStudentData![lstAreaTopic.Column(1)]
    strFieldText = rstStudentData!Me![lstAreaTopic.Column(1)]

    where strFieldText will be the text that is in the selected field. No matter what I try, I always get the error message "Run-time error 3265: Item not found in this collection".

    I want to pass a parameter because I have many fields (about 75) and don't want to get into hard coding all of that!

    Thanks in advance.

  2. #2
    Join Date
    Sep 2005
    If both controls are in the same form, try


    If the controls are on different forms, try


  3. #3
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    strfieldText = rstStudentData(lstAreaTopic.column(1))

    Notice the paranthesis as opposed to brackets, and no exclamation...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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