Results 1 to 3 of 3
  1. #1
    cybermonkey is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2021
    Posts
    10

    Save single field in variable

    For the ultimate end result, I actually have everything working except for one thing.


    I have a form that displays the info of a table, what I need to be able to do is when somebody double clicks a field on that form I need to VBA code that will save the value of the field they double clicked on to be saved in a variable that is defined.
    Currently it's saving the value of the field of the very first record of the table, no matter which one I click on.

    I am sure it's something simple that I am missing.
    Any assistance will be appreciated.

    Below is the current code being used:
    Dim dbsPhoneL As DAO.Database
    Dim rstPubNum As DAO.Recordsets("PhoneList")
    Dim PNum As String


    Set dbsPhoneL = CurrentDb
    Set rstPubNum = CurrentDb.Recordsets




    PNum = rstPubNum("Public Number")

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    I would have thought you'd want something along the lines of

    PNum = Me.Whatever the control is called on your form that holds PhoneNumber for that record?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    cybermonkey is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2021
    Posts
    10
    damn it that's it.
    I was WAY overthinking it. LOL Thanks.

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

Similar Threads

  1. Replies: 2
    Last Post: 11-25-2019, 06:15 PM
  2. Union or variable to return a single row
    By simonsharratt in forum Queries
    Replies: 3
    Last Post: 09-07-2016, 04:12 AM
  3. Building a single variable value of different records
    By stephenaa5 in forum Programming
    Replies: 7
    Last Post: 01-29-2015, 08:36 PM
  4. Replies: 1
    Last Post: 09-03-2014, 05:39 AM
  5. Replies: 1
    Last Post: 08-21-2014, 02:15 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