troubleshooting Question

DoCmd.GoToRecord reporting form not opened error (was working)

Avatar of schmir1
schmir1Flag for United States of America asked on
Microsoft Access
10 Comments2 Solutions361 ViewsLast Modified:
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)"
'    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
  End If

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 2 Answers and 10 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 2 Answers and 10 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004