I'm having trouble with the GoToRecord command. It was working then I change a line below the GoToRecord line and now I'm getting an error on. I think some thing is unstable. Here is the line that generates the error:
DoCmd.GoToRecord acDataForm, "BOM Parts Subform", acGoTo, 2
Here is the error:
Error Number 2489
The object 'BOM Parts Subform' isn't open.
Here is the entire routine:
Dim strQuery As String
Dim strFindDesWild As String
strFindDes = RTrim(InputBox("Please enter search string", "Search Designator field ONLY", strFindDes))
If strFindDes = "" Then
Exit Sub
End If
strFindDesWild = """" & "*" & strFindDes & "*" & """"
strQuery = "SELECT [BOM Parts].[BOM Parts ID] FROM [BOM Parts] INNER JOIN [BOM Designators] ON" & _
" [BOM Parts].[BOM Parts ID] = [BOM Designators].[BOM Parts ID]" & _
" WHERE [BOM Parts].[BOM ID] = " & Parent.txtBOMID & _
" AND [BOM Designators].Designator Like " & strFindDesWild & _
" ORDER BY [BOM Parts].[BOM Parts ID]"
Set rstBOMDes = CurrentDb.OpenRecordset(strQuery, dbOpenSnapshot)
DoCmd.GoToRecord acDataForm, "BOM Parts Subform", acGoTo, 2 '<--------------Error here
If rstBOMDes.EOF Then
MsgBox """" & strFindDes & """ " & " not found in Designator fields" & vbNewLine & _
"Note: Use the ""Find"" button below to search Component, Description, or Comments fields", vbInformation, "User Notice (BPS-11)"
Else
Me.txtBOMPartsID.SetFocus
' DoCmd.FindRecord rstBOMDes![BOM Parts ID], acAnywhere, , acSearchAll, , acAll '<-original line
DoCmd.FindRecord rstBOMDes![BOM Parts ID], acAnywhere, , acSearchAll, True, acAll 'added Search As '< New Line
Me.txtComponentNum.SetFocus
End If
DoCmd.GoToRecord acDataForm, "Forms!NameOFMainForm.[BOM
what was the original line?