Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 31
  1. #16
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    Quote Originally Posted by Micron View Post
    I think I can only help out with the syntax that works with what you're posting. I have no idea if it will work with your real database. First, as I think I noted, I don't use macros so I removed the embedded macro and used the AfterUpdate event of the control. You click on the ellipses (...) in the property sheet to get at that. Do that and enter the code lines between Private Sub and End Sub so that it looks like this:
    Code:
    Private Sub TBXricerca_AfterUpdate()
    
    Me.Filter = "campo1 LIKE '*" & Forms![navigationform].sottomascheraspostamento.Form.TBXricerca & "*' "
    Me.FilterOn = True
    
    End Sub
    I got the form to filter using that. If you put in a value that is not in the records, it will jump to a new record. Not sure if that's ok.

    thanks very much, it worked.


    i cannot thanks you as much as deserve, i'm switching to vba code, just started to learn and it's much better then macros
    if you come in parma you have a big dinner paid

    and i went a bit further nesting my navigation form in another navigation form using "me.tbxricerca" instead of the full reference that gave me problem.
    here the file if someone want to try

    https://hhfinanza-my.sharepoint.com/...YkPRw?e=zeFfmo

  2. #17
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    That looks like the same file...

  3. #18
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    Quote Originally Posted by Micron View Post
    That looks like the same file...
    try this
    https://hhfinanza-my.sharepoint.com/...9CmOg?e=k14fr2

  4. #19
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    No idea why anyone would put a navigation form onto another form. It seems pointless.

  5. #20
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60
    hey ..

    I tried to follow this thread but couldn't quite get there.

    Question 1 - can this be achieved using the macro builder or does one need to put a line of code in VB?

    Question 2 - my Navigation form is called frm_MainNav and the report I target in one of the tabs is called rpt_Catalogue.

    rpt_Catalogue has an event via a hyperlink, to open a details form for that catalogue item. This works when rpt_Catalogue is open directly.

    When rpt_Catalogue is opened on the Nav form and one tries the event it bums, asking for the name field value.

    I saved a new copy of rpt_Catalogue (called srpt_Catalogue) and have plumped for a line of VB code to achieve this.

    Private Sub Name_Click()


    DoCmd.OpenForm "frm_TabbedInfo", acViewForm, , "[Name] = srpt_Catalogue!Name????? ...
    End Sub

    Could anyone provide a steer?

    Thank you

  6. #21
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60
    This opens the form but not to the specified record, only to a blank version of the form ....

    DoCmd.OpenForm "frm_TabbedInfo", acNormal, , "[Name] = Forms.frm_MainNav.NavigationButton18.Name"

  7. #22
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    Hi raddle, this is a very old topic. my knowledge grew a lot, thaks too this forum, and i use no more a navigation form, that's pure evil.
    My suggestion is to create a custom form and use it as navigation form, just putting some button that opens other forms, as you can see in the pic (don't mind the graphic part that is a sh*t)
    i don't even remamber how a navigation form works, but if you want i can help you make your own navigation form, it's pretty easy
    Click image for larger version. 

Name:	Immagine 2023-07-07 113108.png 
Views:	13 
Size:	17.3 KB 
ID:	50457

  8. #23
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    to navigate to a specific record you have to use the "openargs" parameter.

    DoCmd.OpenForm "frm_TabbedInfo", acNormal, , "[Name] = Forms.frm_MainNav.NavigationButton18.Name", me.ID

    so, when you click on a specific record (even on the "name" control) it takes the ID value (the primary key) and bring it to the form just opened.

    of course you have to make some code in the opened form, just like


    Private Sub Form_Open(Cancel As Integer)
    if me.openargs is not null then

    Me.RecordSource = "SELECT table.* FROM Table WHERE (((table.id)= " & Me.OpenArgs & " ))"

    end if

    end sub


    that opens the form and shows the record you want


  9. #24
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60
    Hey - grazie thank you for coming back!

    I am using Nav forms because they are 'easy' hahaah.

    I think this method should work, it is just the syntax of pointing to the name field on the form that I need to get nailed. I tried your version but it gave an error.

    It needs to be something like this but I can't get the specific correct syntax.

    Private Sub Name_Click()
    DoCmd.OpenForm "frm_TabbedInfo", acNormal, , "[Name] = '" & Forms.frm_MainNav.NavigationButton18.Name & "'"




    End Sub

    Grrrrr

  10. #25
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,925
    Start learning to walk your code.
    Either hover over Forms.frm_MainNav.NavigationButton18.Name, or put it and Name= into a string variable and debug.print that.
    You can also use ?
    Forms.frm_MainNav.NavigationButton18.Name in the Immediate window.
    Learn to use breakpoints.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #26
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    sorry, i misunderstood cause i'm working

    i'm not sure about syntax, cause the "[Name] = '" & Forms.frm_MainNav.NavigationButton18.Name & "'" should be the openargs.
    but i don't remember navigation forms

    if you could attach a sample of your DB i could fix it

  12. #27
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60
    Thanks so much both.

    ? Forms.frm_MainNav.NavigationButton18.Name returns NavigationButton18 in immediate window.

    I think I am not passing the field name in the execution.

    The code such as it is (one line!) is stoping at:

    DoCmd.OpenForm "frm_TabbedInfo", acNormal, , "[Name] = Forms.frm_MainNav.NavigationButton18.Name"

    I need to get the field name (which is unhelpfully called [NAME]) into the right part of the quotes...

    I need something like DoCmd.OpenForm "frm_TabbedInfo", acNormal, , "[Name] = Forms.frm_MainNav.NavigationButton18.Name" + the FIELD name .... I think

  13. #28
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,925
    Do not use reserved names anyway.
    So enclose the form address in [ and ]

    You had it more correct before as you need to concatenate the form value with &

    Probably Forms!FormName as well. If the code is in the form then you should be able to use Me, but I have never used navigation forms. They do not exist in 2007.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  14. #29
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    oh now i see, "name" is the name of the field
    try the welsh solution then let us know. Navigation forms are banned in this forum, i think noone are familiar with them

  15. #30
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Raddle, next time start your own thread instead of highjacking a 3-year old discussion. New thread would get more attention, especially when existing is already flagged as solved. Include reference to existing thread if you think it would be helpful.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 10-03-2022, 12:39 PM
  2. Filter buttons in navigation form
    By Charles CL in forum Forms
    Replies: 1
    Last Post: 02-05-2016, 01:04 PM
  3. Replies: 1
    Last Post: 03-05-2015, 07:50 PM
  4. Replies: 1
    Last Post: 11-05-2013, 10:09 PM
  5. Replies: 2
    Last Post: 08-18-2011, 10:20 PM

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