Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Mt. Olive, North Carolina, USA
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    referring to a field name (2000)

    Hi All,
    I am trying to refer to a field name by combining an unbound text box and text. I have tried the following and various combinations of adding ' and chr(32) around the different components.

    Private Sub Combo7_AfterUpdate()
    ' Find the record that matches the control.
    Std = [ Chr(34) & yrstd & Chr(34) & Chr(34) & shrs & Chr(34) & ]
    Me.RecordsetClone.FindFirst "[jn] = " & Chr(34) & Me![Combo7] & Chr(34)
    Me.Bookmark = Me.RecordsetClone.Bookmark
    End Sub

    I have field names 05shrs, 04shrs, 03shrs etc. that I am trying to refer to.
    The unbound text box name is yrstd.
    The unbound text box name I am trying to fill in with a figure from a table that is the record source for the form is std.

    Thank you in advance for your help.
    John

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

    Re: referring to a field name (2000)

    Does this do what you want?

    Me.Std.ControlSource = yrstd & "shrs"

  3. #3
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Mt. Olive, North Carolina, USA
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: referring to a field name (2000)

    Perfect. Thank you for your fast reply.
    John

  4. #4
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Mt. Olive, North Carolina, USA
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: referring to a field name (2000)

    Hans,
    This works great but I was wondering if it is possible to put a formula in the control source of the properties for the unbound text box.
    I tried [yrstd] & "Shrs" and I get #name?.
    yrstd & "Shrs" and I get #name?.
    =[yrstd] & "Shrs" and I get 05Shrs. This is the field name I am looking for but I want the value of the field, not the field name.
    Thank you for all your help.
    Best Regards,
    John

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

    Re: referring to a field name (2000)

    No, you can't do it that way.

Posting Permissions

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