Results 1 to 8 of 8
  1. #1
    mjhopler is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2010
    Posts
    26

    Open form which creates new record

    Can anyone please let me know if the following is possible and how to accomplish.



    I have a form named WorkFlow which is my one stop form for the entire project. I want to be able to open this form and get all the data I need. To do this, I have a second form named TestResults. Upon completing the test we will be running, I want to be able to click a button, it open this form and if there is already a record in the TestResult tbl, open to that record, but if there is not a record for this test result, to automatically have the Property ID field entered to create a new record so we can enter the test results. Possible?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Pass the PropertyID to the form in the OpenArgs argument and then use the OnLoad event to either move to that record if it exists or a new record.

  3. #3
    mjhopler is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2010
    Posts
    26
    I have a very basic understanding of Access and just learned to write my first VBA two days ago (don't know very many codes). Can you please explain this a bit more?

    Thanks

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm a bit lost here. Which form is completed first and why isn't the data available to the second form? Are you putting the information in more than one table?

  5. #5
    mjhopler is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2010
    Posts
    26
    We are entering financials for properties; however, the different properties require different instructions on how to enter the financials. The first time we complete the financials, we will open a form named Abstract (linked to the Abstract table) and enter the specific instructions. The first time this is opened, there will not be a corresponding record in the Abstract tbl. However, the next quarter that we complete the financials, since the abstract was already completed, the button shall open the abstract for the corresponding PropertyId.

    So what I am looking for is when we open the abstract form for the first time, it automatically enters the Property ID in the PropertyID field and creates this record in the Abstract tbl. If the record has previously been created, then it opens to that record.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Use the CommandButton wizard to create a button that opens your 2nd form and then post the code it creates back here so we can modify it for you. What is the name of your PropertyID control on the 1st form?

  7. #7
    mjhopler is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2010
    Posts
    26
    It doesn't show me code, it shows the macro builder.

    Action:OpenForm
    Form Name: frmAbstract
    View: Form
    Filter Name:
    Where Condition: ="[PropertyID]=" & [PropertyID]
    Data Mode:
    Window Mode: Normal

    Both forms have the control PropertyID. This is my link

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Delete the Button and go to:
    OfficeButton>Access Options>Object Designers>Forms/Reports
    ...and check the [Always use event procedures] box.
    Then create the Button with the wizard again.

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

Similar Threads

  1. Replies: 2
    Last Post: 09-24-2009, 08:07 AM
  2. Open form to current record
    By rbpd5015 in forum Access
    Replies: 1
    Last Post: 08-28-2009, 01:53 AM
  3. Replies: 1
    Last Post: 05-16-2009, 08:47 AM
  4. Replies: 4
    Last Post: 03-24-2009, 09:07 PM
  5. Form that runs query and creates reports
    By Valeda in forum Forms
    Replies: 2
    Last Post: 05-04-2006, 07:01 AM

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