Results 1 to 7 of 7
  1. #1
    Jamesy_007 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Location
    Caribbean
    Posts
    86

    Navigating between Forms

    Hello Access Family;

    HELP!...I have this problem I've been at it all last week , I have this btn on a form that takes me directly to another form i.e. =[ID]=" & Nz([ID],0) coded in macro also have it in vba code...
    However when I navigate to the form ID<> ID works perfectly but when I go to the searchcombo box to choose another recorded msgbox displays "person not Found" what am I missing with the "theory of recordsets"... I want to use the searchcombo box to find a name click on a button and go directly to that record in a next Form then go directly to the searchcombo box again and pick another record=name without the msgbox displaying "person not Found" and blocking me from searching again. The code for the searchcombo box it's an After Update event listed below.

    Code:
    Private Sub cbosearch_AfterUpdate()        Dim strCriteria As String
        strCriteria = "[Inm_ID] =" & Nz(Me.cbosearch, 0)
        Me.RecordsetClone.FindFirst (strCriteria)
        If Me.RecordsetClone.NoMatch Then
            msgbox "Person not Found"
        Else
            Me.Bookmark = Me.RecordsetClone.Bookmark
        End If
    End Sub


  2. #2
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,427
    I've tested your code (it works, btw), except I changed "[Inm_ID]" to "[ID]". Your description says the field name is "[ID]", but the code is "[Inm_ID]".

    You say "I want to use the searchcombo box to find a name click on a button and go directly to that record in a next Form..."
    Nowhere in the code is there any command to open a different form or switching to a different form.


    What is the code for the button click?
    What is the ROW source of the combo box "cbosearch"?
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  3. #3
    Jamesy_007 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Location
    Caribbean
    Posts
    86
    Quote Originally Posted by ssanfu View Post
    I've tested your code (it works, btw), except I changed "[Inm_ID]" to "[ID]". Your description says the field name is "[ID]", but the code is "[Inm_ID]".
    Sorry this is my Problem am usually vetting codes trying to type quickly hoping you guys understand =[ID]=" & Nz([ID],0) should be
    =[Inm_ID]=" & Nz([Inm_ID],0) but this is the where condition in the embedded macro note: the code for the button is an embedded macro it works However?????
    Quote Originally Posted by ssanfu View Post
    You say "I want to use the searchcombo box to find a name click on a button and go directly to that record in a next Form..."
    Nowhere in the code is there any command to open a different form or switching to a different form.

    What is the code for the button click?
    What is the ROW source of the combo box "cbosearch"?
    Navigating through the forms back and forth works..... Challenge is when or should i say after I performed this automated task and then go to the search bar i.e. cbosearch I get the msgbox displaying "person not Found" base on my AfterUpdate Event Code tag in first thread. Am trying to go back and forth between forms, ok works..... but also go to the cbosearch box pull another name and look at record this only works in stationary i.e. Opening the forms then searching in the drop-down bar. But when i go to another form via btn on then go cbosearch box doesn't work is it something to do with the recordset?

    The Row source for the cbosearch is a query in the query builder with jus two[2] fields 1.Inm_ID and the other filed is 2.Name in Alphabetical order hiding the ID field...obviously
    Do you understand? "Inm_ID" means Inmate ID

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    2,607
    I think you need to remove the filter before doing the search (as opening the form with a Where condition in DOcmd.OpenForm actually filters the form):
    Code:
    Private Sub cbosearch_AfterUpdate()        
    Dim strCriteria As String
    Me.Filter=""
    Me.FilterOn=False 'remove any existing filters
        strCriteria = "[Inm_ID] =" & Nz(Me.cbosearch, 0)
        Me.RecordsetClone.FindFirst (strCriteria)
        If Me.RecordsetClone.NoMatch Then
            msgbox "Person not Found"
        Else
            Me.Bookmark = Me.RecordsetClone.Bookmark
        End If
    End Sub
    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    Jamesy_007 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Location
    Caribbean
    Posts
    86
    Perfecto! Lol
    Hey Man thanks you're a Pro.... your vba skills are Gr8

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    2,607
    👍 glad to hear it works, good luck with your project!
    Cheers.

  7. #7
    Jamesy_007 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Location
    Caribbean
    Posts
    86
    Quote Originally Posted by Jamesy_007 View Post
    Hello Access Family;

    HELP!...I have this problem I've been at it all last week , I have this btn on a form that takes me directly to another form i.e. =[ID]=" & Nz([ID],0) coded in macro also have it in vba code...
    However when I navigate to the formID<> IDworks perfectly....... [/CODE]
    Hey Guys! all week this have been bothering me "ID<>ID" had to be a typo; should be ID=ID or Inm_ID = Inm_ID compulsively had to rectify.

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

Similar Threads

  1. Replies: 1
    Last Post: 04-25-2016, 08:32 AM
  2. Navigating between Forms
    By jmitchelldueck in forum Forms
    Replies: 6
    Last Post: 08-05-2015, 02:44 PM
  3. Navigating to a Tab Page
    By euphonium01 in forum Macros
    Replies: 5
    Last Post: 12-03-2014, 03:45 AM
  4. No navigating through records??
    By cvansickle in forum Forms
    Replies: 2
    Last Post: 10-27-2010, 04:05 PM
  5. Help record navigating in forms
    By edo in forum Forms
    Replies: 0
    Last Post: 08-12-2008, 10:45 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