Results 1 to 5 of 5

Thread: Access: Load data from one form to another
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular gheyman's Avatar
    Join Date
    Nov 2005
    Location
    Orlando, FL USA
    Posts
    1,632
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Access: Load data from one form to another

    I have code that loads data that is selected on one form to another form (Someone here helped me with - thanks!!!!!)

    The code runs great except for the last line that I tried to add. I want filed "_Upload" to equal "Y". Its a Combo box Formatted True/False

    Code:
    Private Sub LoadItemId_Click()
    [Forms]![frm_VendorQuoteData].[ITEM_ID].Value = Me.ItemID.Value
    [Forms]![frm_VendorQuoteData].[_ITEM_ID_DESC].Value = Me.Description.Value
    [Forms]![frm_VendorQuoteData].[ITEM_RVSN_ID].Value = Me.Rev.Value
    [Forms]![frm_VendorQuoteData].[_COMMD_CODE].Value = Me.Commodity.Value
    [Forms]![frm_VendorQuoteData].[QT_UM_CD].Value = Me.UM.Value
    [Forms]![frm_VendorQuoteData].[_Upload] = "Y"
    End Sub
    Also how do I ensure that form "frm_VendorQuoteData" is open when code is run?. I don't want to open the form, I want to make sure it was already open.

    Thanks
    Last edited by gheyman; Jun 10th, 2019 at 08:05 AM. Reason: Added
    G Heyman
    Northrop Grumman - Laser Systems'
    Apopka, FL

  2. #2
    MrExcel MVP
    Junior Admin
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    50,794
    Post Thanks / Like
    Mentioned
    57 Post(s)
    Tagged
    11 Thread(s)

    Default Re: Access: Load data from one form to another

    If it is a True/False field, it stored values are typically True/False, or numerically -1, 0 (and not the string value "Y").

    So try:
    Code:
    [Forms]![frm_VendorQuoteData].[_Upload] = True
    or
    Code:
    [Forms]![frm_VendorQuoteData].[_Upload] = -1
    Last edited by Joe4; Jun 10th, 2019 at 08:04 AM.
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  3. #3
    Board Regular gheyman's Avatar
    Join Date
    Nov 2005
    Location
    Orlando, FL USA
    Posts
    1,632
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Access: Load data from one form to another

    Thanks Joe. Is there a way to make sure the form "frm_VendorQuoteData" is open before the code is run?
    G Heyman
    Northrop Grumman - Laser Systems'
    Apopka, FL

  4. #4
    MrExcel MVP
    Junior Admin
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    50,794
    Post Thanks / Like
    Mentioned
    57 Post(s)
    Tagged
    11 Thread(s)

    Default Re: Access: Load data from one form to another

    How is this code being called? Is it being called from an event on that Form (if so, the Form would have to be open already)?
    If not, you will need to add a "DoCmd.OpenForm" command at the beginning of your code.

    Note, I see that you have a few question recently that involve using the various "DoCmd" commands.
    Most of these are available under the "Macros" sections. A good way to get the exact code that you need with all the right arguments/values is to create a simple Macro to perform that action (i.e. Open a specific form). Then, convert that Macro to VBA code using the "Convert Macros to Visual Basic" action (found on Macro toolbar). Then, you can just copy/paste the needed lines of code that you need from the converted function to your VBA code.
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  5. #5
    Board Regular
    Join Date
    May 2013
    Posts
    654
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Access: Load data from one form to another

    https://social.msdn.microsoft.com/Fo...orum=accessdev

    Found using https://www.google.com/search?ei=K5L...iz.L9NbBf0X6h0

    Quote Originally Posted by gheyman View Post
    I have code that loads data that is selected on one form to another form (Someone here helped me with - thanks!!!!!)

    The code runs great except for the last line that I tried to add. I want filed "_Upload" to equal "Y". Its a Combo box Formatted True/False

    Code:
    Private Sub LoadItemId_Click()
    [Forms]![frm_VendorQuoteData].[ITEM_ID].Value = Me.ItemID.Value
    [Forms]![frm_VendorQuoteData].[_ITEM_ID_DESC].Value = Me.Description.Value
    [Forms]![frm_VendorQuoteData].[ITEM_RVSN_ID].Value = Me.Rev.Value
    [Forms]![frm_VendorQuoteData].[_COMMD_CODE].Value = Me.Commodity.Value
    [Forms]![frm_VendorQuoteData].[QT_UM_CD].Value = Me.UM.Value
    [Forms]![frm_VendorQuoteData].[_Upload] = "Y"
    End Sub
    Also how do I ensure that form "frm_VendorQuoteData" is open when code is run?. I don't want to open the form, I want to make sure it was already open.

    Thanks
    Office 2007
    Access novice. Sometimes trying to give something back

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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