Results 1 to 6 of 6
  1. #1
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160

    How do I reference a table field of the current record

    Hi,


    Maybe a dumb question, but I can't find the answer (I did try) so I'm back.

    I have some fields on form1, I want to pass fields in the current record that are not on form1 to populate fields on form2.

    I know of a couple of ways

    1. put the fields I want to pass to form2 as hidden fields on form1.
    2. use Form2.textbox = Dlookup("Fieldname","TableName","") - not sure if this takes from the current record

    Thing is if I want to pass a form field I'd just write Form2.controlName = Me.ControlName, so I was thinking that if "Me." was the shorthand way to refer to a form field, there should be a similar way to refer to a table field in the current record like "Tbl.FieldName".

    Is there such a thing?

    Thanks
    David

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    I'm sorry to say that I have no idea what you are trying to do. I think it might be better for you to tell us what your business is dealing with and what you are trying to do. Try not to use any database terms like fields and tables etc
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    Hi Bob, Sorry this wasn't clear - it's a general question about Access not related to what I'm trying to do.

    In the same way you refer to a form field as Me.[ControlName], how would you refer to a table field in the current record?

    Thanks
    David

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    Quote Originally Posted by mdavid View Post
    Hi Bob, Sorry this wasn't clear - it's a general question about Access not related to what I'm trying to do.

    In the same way you refer to a form field as Me.[ControlName], how would you refer to a table field in the current record?

    Thanks
    David
    Providing the field is in the forms Record Source table/query then you just need to type the field name. The Me. is not required. Square brackets will be needed if [field name] has spaces.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    Thanks Bob, So simple - just not obvious to me.

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    Quote Originally Posted by mdavid View Post
    Thanks Bob, So simple - just not obvious to me.
    It wasn't obvious to me either, but at least I am simple
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 01-04-2018, 06:35 PM
  2. Replies: 1
    Last Post: 03-17-2017, 08:08 PM
  3. Replies: 11
    Last Post: 06-15-2016, 06:20 PM
  4. Replies: 4
    Last Post: 02-18-2015, 11:28 AM
  5. Replies: 2
    Last Post: 03-05-2014, 05:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums