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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: You can't go to the specified Record

Status
Not open for further replies.

Zeroanarchy

Technical User
Jun 11, 2001
630
AU
Hi All, thanks for taking time to have a look at this for me.

I am getting an error on the following line:
DoCmd.GoToRecord , , acNewRec

I also tried bring the two lines together:
FROM
DoCmd.GoToRecord , , acNewRec
Me.crewno.Value = NewData
TO
DoCmd.GoToRecord , , NewData

But I still get the same error can anyone tell me where I am going wrong??


Cheers,


CODE:
---------------------------------------------------------
Private Sub crewno_NotInList(NewData As String, Response As Integer)
Dim intReply As Integer
Dim strSQL As String

intReply = MsgBox("Crew No?" & _
vbCrLf & vbCrLf & _
NewData & " is not currently in the list of crew numbers" & _
vbCrLf & vbCrLf & _
"Do you wish to add a new crew to the list now?", _
vbQuestion + vbYesNo + vbDefaultButton2, _
"Add to list")

If intReply = vbYes Then
Me.crewsubform.Visible = False
DoCmd.GoToRecord , , acNewRec
Me.crewno.Value = NewData
Response = acDataErrAdded
Else
Me("crewno").Undo
Me("crewno").Dropdown
Response = acDataErrContinue
End If
End Sub [afro]ZeroAnarchy
Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.

 
you may need to set focus to that form then gotorecord
 
Jioek tried that still no go.

What happens is when in Form view the Msgbox remains up even when you press "Yes", You can actually press Yes as many times as you like and it does nothing. Its only when you press "No" that the error is visible.

I am open to ideas,

Cheers [afro]ZeroAnarchy
Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.

 
You can also get this error if the database index is corrupted. Try running repair and compact, and if that doesn't work, import it into a new blank database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top