Solved form in navigation pane... is a pain ?

TipsyWolf

Member
Local time
Today, 11:16
Joined
Mar 20, 2024
Messages
280
hi guys !

my set up:
1743200122263.png


form - frmTrainingPage
combo box - cboCustomerName
Code:
SELECT Customers.CustomerID, Customers.CustomerName
FROM Customers
ORDER BY Customers.[CustomerID];
combo box - cboSiteTitle
Code:
SELECT CustomerSite.CustomerSiteID, CustomerSite.SiteTitle
FROM CustomerSite
WHERE (((CustomerSite.[CustomerID])=[Forms]![frmTrainingPage]![cboCustomerName]));

i also have vba
Code:
Private Sub cboCustomerName_AfterUpdate()
    Me.cboSiteTitle.Requery
End Sub

and few other Me. where it does Requery

all abovementioned works perfectly in a form, BUT when i move this form to a navigation control it says "enter parameter value Forms!frmTrainingPage!cboCustomerName"

i kinda get that once i move form to a nav. control it behaves like subform so "direct link" wont work, but how do i call
Forms!frmTrainingPage!cboCustomerName
Forms!frmTrainingPage!cboSiteTitle

without calling them like they are?

i tired this and it didn't help.
Code:
Private Sub cboCustomerName_AfterUpdate()
    On Error Resume Next
    Me.cboSiteTitle.Requery
    If Err.Number <> 0 Then
        Screen.ActiveControl.Form.cboSiteTitle.Requery
    End If
    On Error GoTo 0
End Sub
 
That's because your main form becomes a subform when you use a navigation form. So, you'll have to update all references to it.
 
you'll have to update all references to it.
thank you for your reply, but how can i do it ? could u give me a small example with cboCustomerName ?
so i could do same way to everything.
 
thank you for your reply, but how can i do it ? could u give me a small example with cboCustomerName ?
so i could do same way to everything.
For example, this:
Forms!FormName.ComboName
could become something like this:
Forms!NavigationForm.NavigationSubform.Form!ComboName
 
or if you are referencing it from within the navigation form

subformcontrolname.form.comboname
 
It does not seem like you're using two different forms, so why don't you just modify the SQL statement for cboSiteTitle to:
SQL:
SELECT CustomerSite.CustomerSiteID, CustomerSite.SiteTitle
FROM CustomerSite
WHERE (((CustomerSite.[CustomerID])=[cboCustomerName]));

You could do that because both combos are in the same form. If they are not, then let me know.
 
It does not seem like you're using two different forms, so why don't you just modify the SQL statement for cboSiteTitle to:
SQL:
SELECT CustomerSite.CustomerSiteID, CustomerSite.SiteTitle
FROM CustomerSite
WHERE (((CustomerSite.[CustomerID])=[cboCustomerName]));

You could do that because both combos are in the same form. If they are not, then let me know.
yes, they are in the same form
wow ! thank you ! it worked ! gonna steal this solution !
 
all abovementioned works perfectly in a form, BUT when i move this form to a navigation control it says "enter parameter value Forms!frmTrainingPage!cboCustomerName"
Use Me.Parent!cboCustomerName from a subform to its parent form.

REMEMBER when you are using a Navigation form only a SINGLE "main" form is ever loaded at any time and that "main" form is a child of the navigation form so as the others suggested you need to include the name of the actual navigation form when referencing the main form.

The difference in still is necessary because from within the form hierarchy, you can use the shortcut Me.Parent but outside of that, you must use the total formal path.
 
yes, they are in the same form
wow ! thank you ! it worked ! gonna steal this solution !
@Edgar_ not sure if its related to your code, but every time i add new employee's data it also saves all SiteTitles under current ID.
how it works now. i select customer then siteTitle, add few other related into and it saves the same employee under all SiteTitles which are in the list
hm...
1743286985817.png

UPD: it takes all siteTitles (8) times all trainers (3) and i have 24 records...
UPD: no, its not related to your code. its something i have set up incorrectly :(
 
Last edited:
@Edgar_ not sure if its related to your code, but every time i add new employee's data it also saves all SiteTitles under current ID.
how it works now. i select customer then siteTitle, add few other related into and it saves the same employee under all SiteTitles which are in the list
hm...
View attachment 119156
UPD: it takes all siteTitles (8) times all trainers (3) and i have 24 records...
UPD: no, its not related to your code. its something i have set up incorrectly :(

Hi. That's not related to the SQL code I posted.

You have something set up incorrectly. You could make a new thread for that. Get ready to post a sample database, because it'll be easier to figure out that way.
 

Users who are viewing this thread

Back
Top Bottom