Results 1 to 3 of 3
  1. #1
    wcook101 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2020

    How do I open a form using a macro to set the opened form to a specific value?

    I know how to set the default value of an opened form based on a specific value, but I dont wnat to use that method because there will be times when i open that form for another reason so i wouldnt want that vaule as the default.

    The case is specifically, in my customer form i have a button called "create deal" That opens a form called DealsF and i want it to open the form with the customer number already set to the customer I was looking at in Customer form. I also want it set so that when I enter the deals form its already in data entry mode. Is this possible?Customer

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    Yes, it is.

    Use DataMode argument with acFormAdd parameter of OpenForm to specify data entry mode.

    More than one way to set customer number. Code in DealsF Load event could be:

    If Me.NewRecord Then Me.CustomerNumber = Forms!Customer!CustomerNumber

    Be aware this initiates record edit and if form is closed without entering other data, a 'blank' record will be committed.
    How to attach file: To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    wcook101 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2020
    That's pretty nice. Once I tweaked the code to the actual fields it worked great. Now I just have to get the Items subform to jive with the Deal. Thanks so far.

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

Similar Threads

  1. run vba once specific record is opened in form
    By mainerain in forum Programming
    Replies: 1
    Last Post: 07-08-2019, 02:12 PM
  2. Replies: 3
    Last Post: 07-19-2017, 12:40 PM
  3. Replies: 5
    Last Post: 10-18-2016, 06:00 AM
  4. Replies: 1
    Last Post: 02-20-2014, 04:15 PM
  5. Replies: 1
    Last Post: 08-20-2013, 02:17 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 - Senior Forums