Hello,
The refresh form just flash away, not show up on the screen.
I need this refresh form show up on the screen.
Any ideas? Thanks Wdu
The following are my codes:
Private Sub btnSaveAndClose_Click()
On Error GoTo Err_btnSaveAndClose_Click
If Me.Combo6 = 0 Or IsNull(Me.USER_ID) Then
MsgBox "Please choose User from drop down box or go to Driver Registration before exiting"
Else
Dim conn As New ADODB.Connection
' Dim rst As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim sql$
Set conn = CurrentProject.Connection
cmd.ActiveConnection = conn
sql = "Insert into SCHEDULE (RESERVE_DATE_IN, RESERVE_DATE_OUT, " _
& "RESERVE_TIME_IN, RESERVE_TIME_OUT, USER_ID, VEHICLEID) VALUES ('" _
& Me.RESERVE_DATE_IN & "', '" & Me.RESERVE_DATE_OUT & "', '" _
& Me.RESERVE_TIME_IN & "', '" & Me.RESERVE_TIME_OUT & "', " _
& Me.USER_ID & ", '" & Me.VEHICLEID & "');"
cmd.CommandText = sql
cmd.Execute
Set cmd = Nothing
Set conn = Nothing
' How to refresh?
If Me.OpenArgs = "DisplayAll" Then
DoCmd.OpenForm "frmDisplayAll"
Forms("frmDisplayAll"!sbDisplayAll.Form.Requery
Forms("frmDisplayAll".Refresh
Else
DoCmd.Close acForm, "frmPopDivision"
DoCmd.Close acForm, "Reservation"
DoCmd.OpenForm "PickDates"
Forms("PickDates".Vehicle_Sched_subform.Form.Requery
Forms("PickDates".Refresh
End If
End If
Exit_btnSaveAndClose_Click:
DoCmd.Close
Exit Sub
Err_btnSaveAndClose_Click:
MsgBox "Err in save and Close sub: " & Err.Number & " " & Err.Description
Resume Exit_btnSaveAndClose_Click
End Sub
The refresh form just flash away, not show up on the screen.
I need this refresh form show up on the screen.
Any ideas? Thanks Wdu
The following are my codes:
Private Sub btnSaveAndClose_Click()
On Error GoTo Err_btnSaveAndClose_Click
If Me.Combo6 = 0 Or IsNull(Me.USER_ID) Then
MsgBox "Please choose User from drop down box or go to Driver Registration before exiting"
Else
Dim conn As New ADODB.Connection
' Dim rst As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim sql$
Set conn = CurrentProject.Connection
cmd.ActiveConnection = conn
sql = "Insert into SCHEDULE (RESERVE_DATE_IN, RESERVE_DATE_OUT, " _
& "RESERVE_TIME_IN, RESERVE_TIME_OUT, USER_ID, VEHICLEID) VALUES ('" _
& Me.RESERVE_DATE_IN & "', '" & Me.RESERVE_DATE_OUT & "', '" _
& Me.RESERVE_TIME_IN & "', '" & Me.RESERVE_TIME_OUT & "', " _
& Me.USER_ID & ", '" & Me.VEHICLEID & "');"
cmd.CommandText = sql
cmd.Execute
Set cmd = Nothing
Set conn = Nothing
' How to refresh?
If Me.OpenArgs = "DisplayAll" Then
DoCmd.OpenForm "frmDisplayAll"
Forms("frmDisplayAll"!sbDisplayAll.Form.Requery
Forms("frmDisplayAll".Refresh
Else
DoCmd.Close acForm, "frmPopDivision"
DoCmd.Close acForm, "Reservation"
DoCmd.OpenForm "PickDates"
Forms("PickDates".Vehicle_Sched_subform.Form.Requery
Forms("PickDates".Refresh
End If
End If
Exit_btnSaveAndClose_Click:
DoCmd.Close
Exit Sub
Err_btnSaveAndClose_Click:
MsgBox "Err in save and Close sub: " & Err.Number & " " & Err.Description
Resume Exit_btnSaveAndClose_Click
End Sub