Solved

How open 2nd form based on two fields in the 1st form

Posted on 2011-03-09
5
416 Views
Last Modified: 2012-06-27
I have a form, frmProjectDetail, which is bound to tblProjectDetail.  On this form are two fields, "txtJobN", and "txtDetailID".  Neither one of these fields are indexed because there can be duplicate records for "txtJobN".  However ther can only be one "txtDetailID" record number 1, number 2, number 3, etc.

On form frmProjectDetail is a command button.  When the button is clicked I want a 2nd form, "frmFinancialInfo", bound to tblFinancialInfo, to open, leaving form 1 open.  In the second form then are two fields that I want populated with the values from frmProjectDetail... the same two fields as in the 1st form.  And I want this record to be written to tblFinancialInfo after a couple other fields are filled in.

How can I do this?

--Steve
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 34

Expert Comment

by:flavo
ID: 35089455
Something like this on the Click event for a command button should do the trick:


    DoCmd.OpenForm "frmFinancialInfo", acNormal
    Form_frmFinancialInfo.txtJobN.Value = Me.txtJobN.Value
    Form_frmFinancialInfo.txtDetailID.Value = Me.txtDetailID.Value
0
 

Author Comment

by:SteveL13
ID: 35089501
This isn't working quite right.  After the first record is written to the tblFinancialInfo, the same record is opened and the txtJobN and txtDetailID are overwritten with the values from frmProjectDetail using a different record.  Make sense?  I almost feel like some kind of filering needs to be applied using txtJobN and txtDetailID.
0
 
LVL 34

Accepted Solution

by:
flavo earned 500 total points
ID: 35089538
Gotcha! My mistake!!

    DoCmd.OpenForm "frmFinancialInfo", acNormal
    DoCmd.GoToRecord acActiveDataObject, "frmFinancialInfo", acNewRec
    Form_frmFinancialInfo.txtJobN.Value = Me.txtJobN.Value
    Form_frmFinancialInfo.txtDetailID.Value = Me.txtDetailID.Value
0
 

Author Comment

by:SteveL13
ID: 35089570
Close.  Now the only problem is that if I select the same record as used once before from frmProjectDetail the 2nd form is ADDING a new record to tblFinancialInfo instead of overwriting the 1st record written to that table.
0
 

Author Comment

by:SteveL13
ID: 35089605
In other words, the record is a NEW record because the JobN and Detail ID combination has never been used before.  But if the JobN and DetailID combination HAS been used before, then I want the form to open to that record so the values in the other fields on the form can be editted.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question