Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2013
    Posts
    99

    Unanswered: docmd.open Form where Clause problems

    Not sure why this has stopped working,

    I have a form which opens another form based on the options selcect from a dropdown box.

    The form Loads but only loads a balnk form. Have checked then naming conventions for the feilds and control source and they are all correct.

    Also having a problem with the checking and messaging if the record does not exist below is the code I am running

    Private Sub Submit_Click()

    If IsNull(Me.Log_Number) Or IsNull(Me.Type_of_Incident) = True Then
    MsgBox "Feilds cannot be Left Blank"

    Exit Sub
    End If

    DoCmd.OpenForm Me.Type_of_Incident, , , "[Log Number]= '" & Me.Log_Number & "'"


    If Me.RecordsetClone.RecordCount = 0 Then
    MsgBox "There are zero records in the data source!", vbInformation, "No Records Found"
    DoCmd.Close acForm, Me.Name
    End If
    DoCmd.Close acForm, "continue report", acSaveNo
    DoCmd.Close acForm, "Selection", acSaveNo
    End Sub

    Thank you

  2. #2
    Join Date
    Feb 2013
    Posts
    99

    Hummm Strange

    Issue continues but noticed that if I am running the table linked in the control source and then run the onclick event the form the correct form opens.

    The correct form does in deed Load

    Hummmm

    Any Ideas


    Thank you

  3. #3
    Join Date
    Feb 2013
    Posts
    99

    Solved

    Right

    It helps if you dont put in the onload event docmd.gotorecord,,acnew DOH

    Rather instead put it in the previous form that launches the Form

    Thanks for all readers sorry to have wasted your time

Posting Permissions

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