How to run a form and push a button automatically?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • farzad
    New Member
    • Dec 2010
    • 4

    #1

    How to run a form and push a button automatically?

    hi dear all

    question for "Run a form and push a button automatically"

    I have a form With name "ReportingDateR ange"

    this form save 2 text for reporting daterange with start date and finish date .... i have a button on this form with name "SAVE" in event of this button i said

    Private Sub Preview_Click()

    Save Me.Name 'Call function code

    End Sub

    In Public function i have too bellow code :

    Public Function Save(ByVal strfrm As String)
    Dim frm As Form

    Set frm = Forms(strfrm)
    If IsNull(frm![Beginning Entry Date]) Or IsNull(frm![Ending Entry Date]) Then

    MsgBox "You must enter both beginning and ending dates."

    DoCmd.GoToContr ol "Beginning Entry Date"
    Else
    If [frm]![Beginning Entry Date] > frm![Ending Entry Date] Then
    MsgBox "Please Retype Finish Date : Must be Greater or Equal Than Current Date"
    DoCmd.GoToContr ol "Beginning Entry Date"
    Else
    frm.Visible = False
    End If
    End If
    End Function

    this is work fine but in first open database user must save atleast one more time to open this "Reportdaterang e" form and push this SAVE button


    now Question : after database run in autoexec i have to run "Reportdaterang e" form for user to push save for first time
    i want to open form in run database and **** run save automatically and close form*******
Working...