• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

How do you display information in a form when the form is already open?

I have a form in a navigation form. On that form I have a custom search feature. When the user has typed in the info for the search criteria, how do I pass it to the form in the nav form instead of opening another form?
Is there something else other than OpenForm I could use?

Thank you,
KB5
0
Kennyboy5
Asked:
Kennyboy5
  • 4
  • 3
1 Solution
 
Jeffrey CoachmanCommented:
Just curious...

Why do you need a subform value to appear n the main (navigation) form.
I just use navigation forms to "navigate"

Beyond this, I would need to see a sample of your database.
I don't know what this means:
<When the user has typed in the info for the search criteria, how do I pass it to the form in the nav form >
Pass what?.. the criteria, or the search result?
Pass it to what form specifically...?
...etc

Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Remove any records unless they are relevant to the issue.
5. Delete any objects that do not relate directly to the issue.
6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
9. Compile the code. (From the VBA code window, click: Debug-->Compile)
10. Run the compact/Repair utility.
11. Remove any Passwords and/or security.
12. If a form is involved in the issue, set the Modal and Popup properties to: No
    (Again, unless these properties are associated with the issue)
13. Post the explicit steps to replicate the issue.
14. Test the database before posting.

In other words, ...post a database that we can easily open and immediately see and/or troubleshoot the issue.
And if applicable, also include a clear graphical representation of the *Exact* results you are expecting, based on the sample data.

JeffCoachman
0
 
Kennyboy5Author Commented:
I have a navigation form called frmMainNav. One of the tabs in the navigation form display my main form called frmCOP. On frmCOP I have a search button that pops up a form with some fields like FirstName, LastName, DOB and when they populate any or all of the fields and hit the search button it finds the record (ClientID) and what I want it to do is display that record on the frmCOP within the frmMainNav. So I have the record but I don't know how to push it to the frmCOP in the frmMainNav. If I use DoCmd.OpenForm with just the frmCOP (without using frmMainNav) by itself it populates fine but because frmCOP is in a tab in the navigation form when I tell it to DoCmd.OpenForm to the frmMainNav it's prompting me for the ClientID. When I step through the code it does in fact have the ClientID which makes me believe that my syntax is not correct. Here is the code:
Private Sub Command4_Click()
Dim strFilter As String
    ' Set up the filter
    strFilter = "(ClientID = " & Me.txtClientID & ")"
    ' Open contacts filtered on the current row
    DoCmd.OpenForm FormName:="frmMainNav", WhereCondition:=strFilter
    
    ' Close me
    DoCmd.Close acForm, Me.Name
    ' Put focus on clients
    Forms!frmMainNav.SetFocus
End Sub

Open in new window


Thanks again for responding,
KB5
0
 
Jeffrey CoachmanCommented:
Again, without a sample database I am at a handicap here.

In the most basic sense you can just take the control values and reference them in another form.
Yourmainform.Control=YourSubform.control

Something like this for the controlsource of the "FirstName" control on the main form:
=Forms!YourSubform!txtFirstName
0
Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

 
Kennyboy5Author Commented:
Here's the database. You'll need Access 2010 to open. There are only 3 records for testing purposes. Steps to produce my problem are as follows:
1. Open up the frmMainNav form
2. Click the 'binoculars' for search at the top of the COP form
3. For the last name in the search window enter the name of 'Davis' (which has a ClientID of 2) and then hit the 'Search' button
3. You'll get a popup saying that it found 1 client. Click yes to see the list.
4. With the frmClientSearchResults now open, click on the record selector beside 'Rod Davis' and at the bottom click on 'View Details'

It then prompts me for the ClientID and I'm not sure why. Even if I put in '2' for the parameter of Rod Davis it doesn't reflect back to the COP form in the frmMainNav.

This is pretty much my problem.

Thanks again,
COP.accdb
0
 
Jeffrey CoachmanCommented:
You are trying to open the Nav form based on ClientID
    DoCmd.OpenForm "frmMainNav", acNormal, , "ClientID=" & Me.[txtClientID]

...Yet the Nav form does not contain this filed/control...
(The "SUB" form in the nave form contains this field....)

If your main goal here is to filter the nav form for a certain Client , then you don't need the "Find" button,  and I don't really see a need to open another pop-up form.

There is a combobox wizard that simply finds the record you select.
See mi modified sample
COP.accdb
0
 
Kennyboy5Author Commented:
Perfect! Thanks a lot for your help. I appreciate it

KB5
0
 
Jeffrey CoachmanCommented:
Great, always remember, you can always ask our advice before creating design elements.

;-)

Jeff
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now