Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run time error 2105 You can't go to the specified record

Status
Not open for further replies.

0011268899

IS-IT--Management
Nov 4, 2003
8
US
I have a 'main menu' form in which a user can click on a button to edit a record. After clicking on the 'edit record' button, another form called 'input search' pops up. The user can enter in a ssn#, last name, etc to locate a record. Well when a user enters in any one of these pieces of information to locate a customer and clicks on the 'search' button, I get a run time error 2105: you can't go to the specified record. When I click on the debug option, the line that's highlighted is:

DoCmd.GoToRecord acDataForm, "Master-Main", acLast.

What's strange is I have another form (let's call it 'Test Record' form) and I have a search button on that form that when clicked, it'll pop up the same 'input search' form that I mentioned earlier. When you use the search option from the Test Record form, the appropriate record is found and I don't get an error message. Enclosed is my code:

Private Sub CmdSearch_Click()
Dim TextEntry

If Not IsNull(SearchText) And SearchText <> &quot;&quot; Then
TextEntry = SearchText
If Frame2 = 1 Then
DoCmd.OpenForm &quot;Master-Main&quot;
DoCmd.Maximize
DoCmd.GoToRecord acDataForm, &quot;Master-Main&quot;, acLast
Forms![Master-Main].[SSN].SetFocus
DoCmd.FindRecord TextEntry, , , , True
If Forms![Master-Main].[SSN] <> TextEntry Then
MsgBox &quot;Sorry, No record matching your entry could be found!&quot; & _
Chr(10) & Chr(10) & &quot;Please re-enter or click the Exit button to abort.&quot;, vbInformation
Exit Sub
End If
DoCmd.Close acForm, &quot;InputSearch&quot;, acSaveNo
ElseIf Frame2 = 2 Then
DoCmd.OpenForm &quot;Master-Main&quot;
DoCmd.Maximize
DoCmd.GoToRecord acDataForm, &quot;Master-Main&quot;, acLast
Forms![Master-Main].[CONTROL_Nr].SetFocus
DoCmd.FindRecord TextEntry, , , , True
If Forms![Master-Main].[CONTROL_Nr] <> TextEntry Then
MsgBox &quot;Sorry, No record matching your entry could be found!&quot; & _
Chr(10) & Chr(10) & &quot;Please re-enter or click the Exit button to abort.&quot;, vbInformation
Exit Sub
End If
DoCmd.Close acForm, &quot;InputSearch&quot;, acSaveNo
ElseIf Frame2 = 3 Then
DoCmd.OpenForm &quot;Master-Main&quot;
DoCmd.Maximize
DoCmd.GoToRecord acDataForm, &quot;Master-Main&quot;, acLast
Forms![Master-Main].[LAST_NAME].SetFocus
DoCmd.FindRecord TextEntry, , , , True
If Forms![Master-Main].[LAST_NAME] <> TextEntry Then
MsgBox &quot;Sorry, No record matching your entry could be found!&quot; & _
Chr(10) & Chr(10) & &quot;Please re-enter or click the Exit button to abort.&quot;, vbInformation
Exit Sub
End If
DoCmd.Close acForm, &quot;InputSearch&quot;, acSaveNo
Else
MsgBox &quot;You must select the criteria type!&quot;, vbCritical
Exit Sub
End If
Else
MsgBox &quot;You must enter search criteria.&quot;, vbCritical
Exit Sub
End If

End Sub


Any help is greatly appreciated. I am fairly new to Access and came into the development of this database at the far end of the project so bear with me. Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top