Solved

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

Posted on 2011-03-09
5
402 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
  • 3
  • 2
5 Comments
 
LVL 34

Expert Comment

by:flavo
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now