Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Aug 2002
    Location
    Atlanta, Georgia, USA
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple Form synchronization (Access2000)

    I am having trouble with synchronizing my forms. I have the relationship created between the two files, basically a form for each file. I receive the following message: ambiguous name detected: find_next_click. Here is the vb script. Can I be helped? Thanks in advance. I have not set these up as sub forms since either form will be used independently and will toggled between as needed.

    Carl

    Private Sub find_next_Click()
    On Error GoTo Err_find_next_Click


    Screen.PreviousControl.SetFocus
    DoCmd.FindNext

    Exit_find_next_Click:
    Exit Sub

    Err_find_next_Click:
    MsgBox Err.Description
    Resume Exit_find_next_Click

    End Sub
    Private Sub Previous_Click()
    On Error GoTo Err_Previous_Click


    DoCmd.GoToRecord , , acPrevious

    Exit_Previous_Click:
    Exit Sub

    Err_Previous_Click:
    MsgBox Err.Description
    Resume Exit_Previous_Click

    End Sub
    Private Sub find_next_Click()
    On Error GoTo Err_find_next_Click


    Screen.PreviousControl.SetFocus
    DoCmd.FindNext

    Exit_find_next_Click:
    Exit Sub

    Err_find_next_Click:
    MsgBox Err.Description
    Resume Exit_find_next_Click

    End Sub
    Private Sub Exit_Click()
    On Error GoTo Err_Exit_Click


    DoCmd.Close

    Exit_Exit_Click:
    Exit Sub

    Err_Exit_Click:
    MsgBox Err.Description
    Resume Exit_Exit_Click

    End Sub
    Private Sub Command95_Click()
    On Error GoTo Err_Command95_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "MASTER"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_Command95_Click:
    Exit Sub

    Err_Command95_Click:
    MsgBox Err.Description
    Resume Exit_Command95_Click

    End Sub

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple Form synchronization (Access2000)

    Notice in the copy of your code that I displayed in blue that you have two subs with the same name. That is what caused the ambiguous name detected error message.


    <font color=blue>Private Sub find_next_Click()
    On Error GoTo Err_find_next_Click
    Screen.PreviousControl.SetFocus
    DoCmd.FindNext
    Exit_find_next_Click:
    Exit Sub
    Err_find_next_Click:
    MsgBox Err.Description
    Resume Exit_find_next_Click
    End Sub</font color=blue>


    Private Sub Previous_Click()
    On Error GoTo Err_Previous_Click
    DoCmd.GoToRecord , , acPrevious
    Exit_Previous_Click:
    Exit Sub
    Err_Previous_Click:
    MsgBox Err.Description
    Resume Exit_Previous_Click
    End Sub


    <font color=blue>Private Sub find_next_Click()
    On Error GoTo Err_find_next_Click
    Screen.PreviousControl.SetFocus
    DoCmd.FindNext
    Exit_find_next_Click:
    Exit Sub
    Err_find_next_Click:
    MsgBox Err.Description
    Resume Exit_find_next_Click
    End Sub</font color=blue>


    Private Sub Exit_Click()
    On Error GoTo Err_Exit_Click
    DoCmd.Close
    Exit_Exit_Click:
    Exit Sub
    Err_Exit_Click:
    MsgBox Err.Description
    Resume Exit_Exit_Click
    End Sub


    Private Sub Command95_Click()
    On Error GoTo Err_Command95_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "MASTER"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Exit_Command95_Click:
    Exit Sub
    Err_Command95_Click:
    MsgBox Err.Description
    Resume Exit_Command95_Click
    End Sub
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  3. #3
    New Lounger
    Join Date
    Aug 2002
    Location
    Atlanta, Georgia, USA
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple Form synchronization (Access2000)

    Judy,
    Thanks for the help, I missed the somewhat obvious that fixed the ambiguous name issue. However I am still not synchronizing between the two forms. What must I do so that the second form opens to the records which the first form had displayed?

    Thanks

    Carl Gruber

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Simple Form synchronization (Access2000)

    The simplest method is to use the WhereCondition argument of DoCmd.OpenForm. Your WhereCondition should be a string that is the equivalent of a WHERE clause in a SQL statement but without the word "Where". It might look something like this: "KeyField = " & Me!KeyControl

    Ive used KeyField to represent the name of a field in the called form's recordset and KeyControl to represent the name of the control on the current form that holds the value you want to use to filter the records on the form being opened.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •