Results 1 to 11 of 11
  1. #1
    NikoTheBowHunter is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Posts
    58

    Help updating macro code to work in navigation form

    I need some help getting this search macro to work when the form is moved into my navigation form. the form by itself works flawlessly, but I cant seem to get the code to work once moved into the navigation form.



    In the "On Click" event for the search button I have an embedded Marco with the following:

    ApplyFilter
    Filter Name (blank)
    Where Condition = [Offender Name] Like "*" & [Forms]![Form: Search]![Text12] & "*" Or [Notes History] Like "*" & [Forms]![Form: Search]![Text12] & "*"
    Control Name (blank)

    My navigation form is named [Form: Main Menu]
    The navigation subform name was not changed so is still [NavigationSubform]

    I have tried to update the code to reflect the form being moved into the navigation form but with no luck. Here are some options I tried based on some internet searching, again no luck getting this to work.

    [Offender Name] Like "*" & [Forms]![Form: Main Menu]![NavigationSubform]![Form: Search]![Text12] & "*" Or [Notes History] Like "*" & [Forms]![Form: Main Menu]![NavigationSubform]![Form: Search]![Text12] & "*"


    [Offender Name] Like "*" & [Forms]![Form: Main Menu]![NavigationSubform].[Form]![Text12] & "*" Or [Notes History] Like "*" & [Forms]![Form: Main Menu]![NavigationSubform].[Form]![Text12] & "*"


    Where am I going wrong? Should I not be using a macro within the navigation form? If not could someone provide me with the VBA code I should use? Thanks in advance for any input that is offered. sorry for the noobish question.


    Cheers,
    Niko

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Try:
    Code:
    [Offender Name] Like "*" & Forms![Form: Main Menu].[NavigationSubform].Form.[Form: Search].[Text12] & "*" Or [Notes History] Like "*" & Forms![Form: Main Menu].[NavigationSubform].Form.[Form: Search].[Text12] & "*"
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    NikoTheBowHunter is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Posts
    58
    I tried the above code and still get the same error message. Maybe the code isn't the issue??? Here is the error message I get when trying to perform the search within the navigation form:

    Click image for larger version. 

Name:	popupmsg.jpg 
Views:	13 
Size:	97.3 KB 
ID:	29743

    when not opened in the navigation form and using the original macro, have no issues. only when its moved to the navigation form and code is updated to reflect the move I get the above message.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    So is the main form or the sub form bound to a table or a query
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    NikoTheBowHunter is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Posts
    58
    On that I am not 100% sure of. Could you provide some direction on where one would check for this? From what I remember I think I created a blank navigation form and then started putting my other forms into the navigation form from the layout view.

  6. #6
    NikoTheBowHunter is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Posts
    58
    Click image for larger version. 

Name:	NavForm.jpg 
Views:	12 
Size:	110.9 KB 
ID:	29744Click image for larger version. 

Name:	NavSubform.jpg 
Views:	12 
Size:	97.5 KB 
ID:	29745

    Not sure if this helps any.

  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    The form's Record Source property would need to be set to the name of a table or a query and the controls on the form (text boxes etc) would need to have their Control Source property set to a field in the table /query that the form is bound to.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  8. #8
    NikoTheBowHunter is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Posts
    58
    I apologize but I am a complete noob at this, just a guy who works back in inventory and created a database to track our equipment after watching a couple youtube videos. I am not our IT guy, so again my apologies for the above going right over my head.

    The form's Record Source property would need to be set to the name of a table or a query and the controls on the form (text boxes etc) would need to have their Control Source property set to a field in the table /query that the form is bound to.
    My forms are as follows:

    [Form: Main Menu] (the navigation form) - has no Record Source

    [Form: Search] - has a Record Source, its the query I built for the original search form
    Within the [Form: Search] header I have an unbound text box [Text12], which has no Control Source and the search button [Command14] with the embedded macro listed above.
    Within the [form: Search] Detail section I have 3 fields, all with control sources linked to fields from the query mentioned.

  9. #9
    NikoTheBowHunter is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Posts
    58
    bumping in hopes someone can help me out

  10. #10
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    I think the silence here is because no one wants to get into the navigation form tangle, including me. It runs into all sorts of problems such as yours as well as a myriad of others as you try to add functionality to that construction. The frustration is endless.
    IMO, you would be much better off in the long run using a main form with the tab control. Each tab would hold one of your subforms. Google "access tab control", then Google "access navigation form". See the difference? Navigation forms are avoided, while tab controls are well supported.
    Last edited by davegri; 08-02-2017 at 12:55 PM.

  11. #11
    NikoTheBowHunter is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Posts
    58
    Thanks for the input. My database will be null and void in 12-16 months so rebuilding it from ground up again for tab control isn't really worth it at this point in time. Though "tab control" looks to be the way to go. I can use the built in "Find" option, does whats needed, not ideal but gets the job done until I toss this DB into the recycle bin. thanks for the input davegri.

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

Similar Threads

  1. Subform within Navigation form won't work
    By revolution9540 in forum Forms
    Replies: 16
    Last Post: 07-28-2015, 04:33 PM
  2. Replies: 5
    Last Post: 12-09-2014, 02:38 PM
  3. Replies: 1
    Last Post: 11-18-2014, 12:35 PM
  4. Replies: 11
    Last Post: 12-11-2013, 10:35 AM
  5. Replies: 1
    Last Post: 07-01-2013, 07:09 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