Results 1 to 5 of 5

Thread: Runtime (A2000)

  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Runtime (A2000)

    I have the following code on a button.
    On a runtime version of my db I get Error 2450 cannot find form !
    Does any one know a remedy for this.

    Dave


    Private Sub Command14_Click()

    Dim db As DAO.Database
    Dim RST As DAO.Recordset
    Dim strFilter As String
    Dim strSQL As String
    Dim strValue As String
    Set db = CurrentDb
    strFilter = "tblEnquiry.EstimateNo = " & Forms!frmDetails!EstimateNo & " And tblEnquiry.Supp = " & Forms!frmDetails.Supp
    strSQL = "Select * From tblEnquiry Where " & strFilter
    Set RST = db.OpenRecordset(strSQL, dbOpenDynaset)
    If RST.RecordCount = 0 Then
    DoCmd.OpenForm "frmEnquiry"
    DoCmd.GoToRecord acDataForm, "frmEnquiry", acNewRec
    Forms!frmEnquiry!EstimateNo.SetFocus
    Forms!frmEnquiry!EstimateNo = Forms!frmDetails!EstimateNo
    Forms!frmEnquiry!Supp = Forms!frmDetails!Supp
    Else
    DoCmd.OpenForm "frmEnquiry", acViewNormal, , strFilter
    End If
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Runtime (A2000)

    It would be useful to know where exactly the error occurs. Now, you can't single-step code in a runtime environment.

    You can insert statements between the existing statements that inform you of what is being executed. You can make this as sophisticated as you like, but the following is a way, however tedious:

    Set db = CurrentDb
    MsgBox "Set strFilter"
    strFilter = "tblEnquiry.EstimateNo = " & Forms!frmDetails!EstimateNo & " And tblEnquiry.Supp = " & Forms!frmDetails.Supp
    MsgBox "Set strSQL"
    strSQL = "Select * From tblEnquiry Where " & strFilter
    MsgBox "Set rst"
    Set RST = db.OpenRecordset(strSQL, dbOpenDynaset)
    MsgBox "Check for records"
    If RST.RecordCount = 0 Then
    MsgBox "Open frmEnquiry"
    DoCmd.OpenForm "frmEnquiry"

    etc.

    When you get the error message, you'll know what statement the code was trying to execute.

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Runtime (A2000)

    Thanks Hans
    Tedious but neccessary.

    Dave

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Runtime (A2000)

    Is this command giving you the problem?

    strFilter = "tblEnquiry.EstimateNo = " & Forms!frmDetails!EstimateNo & " And tblEnquiry.Supp = " & Forms!frmDetails.Supp

    Try changing the Forms!frmDetails.Supp to Forms!frmDetails!Supp (changing the fullstop to a bang as Charlotte puts it)

    HTH
    Pat

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Runtime (A2000)

    Thanks for your reply Patt, I hadn't noticed it before, it may be the solution I need.

    Can't get to the runtime machine at the moment, but I will try it.

    Regards
    Dave

Posting Permissions

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