John W. Vinson said:
In the code which opens the report (probably the combo box's AfterUpdate
event). Care to post the code?
Thanks John I added a code to the report so when It closed it opened my
form, Just trying now to set focus to cbOwnersName on my form so as when I
click the preview control the focus shifts to cbOwnersName
Regards Bob
Private Sub Report_Deactivate()
DoCmd.Close
DoCmd.OpenForm "frmBillStatement", acNormal, , , , acDialog,
"OwnerStatement"
End Sub
Private Sub cmdStatementOld_Click()
Dim savRepName As String, savFileName As String
Select Case Me.OpenArgs
Case "OwnerStatement"
If IsNull(cbOwnerName.value) = True Or cbOwnerName.value =
vbNullString Then
MsgBox "Please make a Seletion!", vbApplicationModal +
vbInformation + vbOKOnly
Exit Sub
End If
Me.Visible = False
DoCmd.OpenReport "rptOwnerPaymentMethodShort", acPreview
Me.cbOwnerName.SetFocus
Case "MonthlyPaid"
savRepName = "rptGenericReport"
savFileName = "Montly Paid.rtf"
Me.Form.Visible = False
DoCmd.OpenReport savRepName, acViewPreview, , , , Me.OpenArgs
Case "OwnerDue"
Me.Visible = False
DoCmd.OpenReport "rptGenericReport", acViewPreview, , , ,
"OwnerDue"
DoCmd.Close acForm, Me.Name
Me.cbOwnerName.SetFocus
Case "OwnerPaymentMethod"
If IsNull(cbOwnerName.value) = True Or cbOwnerName.value =
vbNullString Then
MsgBox "Please make a Selection!", vbApplicationModal +
vbInformation + vbOKOnly
Exit Sub
End If
Me.Visible = False
DoCmd.OpenReport "rptGenericReport", acViewPreview, , , ,
"OwnerPaymentMethodShort"
DoCmd.Close acForm, Me.Name
Me.cbOwnerName.SetFocus
Case "PaymentMethod"
Dim nDateDiff As Integer, nSign As Integer
nDateDiff = DateDiff("d", CDate(tbDateFrom.value),
CDate(tbDateTo.value))
nSign = Sgn(nDateDiff)
If nSign = -1 Or nSign = 0 Then
MsgBox "Please Select Date In Proper Range.",
vbApplicationModal + vbExclamation + vbOKOnly
cmdCalenderTo.SetFocus
Exit Sub
End If
Me.Visible = False
DoCmd.OpenReport "rptGenericReport", acViewPreview, , , ,
"PaymentMethod"
DoCmd.Close acForm, Me.Name
Me.cbOwnerName.SetFocus
Case "PrintInvoiceBatch"
If IsNull(tbDateFrom.value) Or tbDateFrom.value = "" Or
IsNull(tbDateTo.value) Or tbDateTo.value = "" Then
MsgBox "Please Enter the Begining Date and End Date.",
vbApplicationModal + vbInformation + vbOKOnly
Exit Sub
End If
Me.Visible = False
DoCmd.OpenReport "rptInvoiceBatch", acViewPreview, , , ,
"PrintInvoiceBatch"
Case "PrintStatementBatch"
If IsNull(tbDateFrom.value) Or tbDateFrom.value = "" Or
IsNull(tbDateTo.value) Or tbDateTo.value = "" Then
MsgBox "Please Enter the Begining Date and End Date.",
vbApplicationModal + vbInformation + vbOKOnly
Exit Sub
End If
Me.Visible = False
DoCmd.OpenReport "rptOwnerPaymentMethodBatch", acViewPreview, , , ,
"PrintStatementBatch"
End Select
End Sub
Private Sub cmdStatementOld_GotFocus()
cbOwnerName.SetFocus
End Sub
Private Sub cmdStatementOld_KeyUp(KeyCode As Integer, Shift As Integer)
Me.cbOwnerName.SetFocus
End Sub