Hi all,
I have been playing with this all morning with just msgboxes and this does work. What I cant figure out is to set focas on the Primary Form to that the subform changes to CmdviewPayBill?
Basically If it doesnt meet the If criteria, then I want it to click the cmd button "CmdViewPayBill" on the primary form
Which would change it to a different subform (sourceObject in this case)
I cant figure out how to do that?
Here is what I have so far, I ' out some so it didnt open the form up all the time.
Code:
Private Sub CmdPayment_Click()
'Dim Control As Control
If DCount("BillID", "qryReceiveBill", "AccountID= " & Me.AccountID & "") <= 0 Then
MsgBox ("You must first Enter Bill First, Would you like to add now?")
ElseIf DCount("BillID", "qryReceiveBill", "AccountID= " & Me.AccountID & "AND IsPaid = True") Then
MsgBox ("You must first Enter Bill First")
'DoCmd.OpenForm "frmTransBill"
'DoCmd.GoToRecord , , acNewRec
Else
MsgBox ("PayNow")
'Forms!frmAcctount!CmdViewPayBill.SetFocus
End If
End Sub
Thanks