Using a Check Box as a Condition

B

Bob V

In tblHorseDetails I have a 4 Fields
[HorseID] Number
[OwnerID] Number
[OwnerPercent] Number
[Invocing] Yes/No, (Check Box)
Effectively you set your horse up with one or more Owners with there percent
in that 1 Horse
I am trying to do is that when that record has a False in Invoicing it will
not create an Invoice
Below is the Code for Distributing the Invoice at the end of the month
Or do you think it has to been done in subSetInvoiceValues 16 row down
Any help would be much appreciated...............Bob

Private Sub cmdSave_Click()
With recInvoice
Dim recHorseOwners As New ADODB.Recordset, dblOwnerPercentAmount As
Double
Dim dblTotal As Double, dblGSTContentsValue As Double

recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM
tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 ORDER BY OwnerID ",
CurrentProject.Connection, adOpenDynamic, adLockOptimistic

If recHorseOwners.EOF = True And recHorseOwners.BOF = True Then
recHorseOwners.Close
Set recHorseOwners = Nothing
MsgBox "This Horse Has No Client Select, [CLOSE] " & vbCrLf &
vbCrLf & " Go to Horses and enter a Client before Distributing.",
vbApplicationModal + vbNo + vbInformation
Exit Sub
End If

If MsgBox("Do You Want To Distribute?", vbQuestion + vbApplicationModal
+ vbYesNo + vbDefaultButton1, "Intellisoft") = vbYes Then
recInvoice.AddNew
subSetInvoiceValues
recInvoice.Update


subDeleteInvoiceItmdt

subBlankForm
lbOwnerlist1.value = ""
lbOwnerlist1.RowSource = ""

lbOwnerlist1.SetFocus
cmdSave.Enabled = False
bModify = False
End If

Forms!frmModify![lstModify] = Null
Form_frmModify.lstModify.Requery
End With
 
B

Bob V

Ok Ive worked out it must be [subSetInvoiceValues] so somewhere I have to
add Invocing = True
This is part of the subSetInvoiceValues that needs changing
Thanks if you can help............Bob


recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 ORDER BY OwnerID ",
CurrentProject.Connection, adOpenDynamic, adLockOptimistic
 
B

Bob V

YES YES YES I got it
recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 AND Invoicing = True
ORDER BY OwnerID ", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
:) :) :) .........................Bob

Bob V said:
Ok Ive worked out it must be [subSetInvoiceValues] so somewhere I have to
add Invocing = True
This is part of the subSetInvoiceValues that needs changing
Thanks if you can help............Bob


recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 ORDER BY OwnerID ",
CurrentProject.Connection, adOpenDynamic, adLockOptimistic


Bob V said:
In tblHorseDetails I have a 4 Fields
[HorseID] Number
[OwnerID] Number
[OwnerPercent] Number
[Invocing] Yes/No, (Check Box)
Effectively you set your horse up with one or more Owners with there
percent in that 1 Horse
I am trying to do is that when that record has a False in Invoicing it
will not create an Invoice
Below is the Code for Distributing the Invoice at the end of the month
Or do you think it has to been done in subSetInvoiceValues 16 row down
Any help would be much appreciated...............Bob

Private Sub cmdSave_Click()
With recInvoice
Dim recHorseOwners As New ADODB.Recordset, dblOwnerPercentAmount
As Double
Dim dblTotal As Double, dblGSTContentsValue As Double

recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM
tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 ORDER BY OwnerID ",
CurrentProject.Connection, adOpenDynamic, adLockOptimistic

If recHorseOwners.EOF = True And recHorseOwners.BOF = True Then
recHorseOwners.Close
Set recHorseOwners = Nothing
MsgBox "This Horse Has No Client Select, [CLOSE] " & vbCrLf &
vbCrLf & " Go to Horses and enter a Client before Distributing.",
vbApplicationModal + vbNo + vbInformation
Exit Sub
End If

If MsgBox("Do You Want To Distribute?", vbQuestion +
vbApplicationModal + vbYesNo + vbDefaultButton1, "Intellisoft") = vbYes
Then
recInvoice.AddNew
subSetInvoiceValues
recInvoice.Update


subDeleteInvoiceItmdt

subBlankForm
lbOwnerlist1.value = ""
lbOwnerlist1.RowSource = ""

lbOwnerlist1.SetFocus
cmdSave.Enabled = False
bModify = False
End If

Forms!frmModify![lstModify] = Null
Form_frmModify.lstModify.Requery
End With
 
B

Bob V

When I distribute 1 Invoice at a time it works PERFECTLY but when I use this
other control code which Distributes all my Invoices at once:
If nRtnValue = vbYes Then
DoCmd.Hourglass True
subSetInvoiceValues
Application.SysCmd acSysCmdSetStatus, "Process is completed."
Application.SysCmd acSysCmdClearStatus
DoCmd.Hourglass False
Me.lstModify.Requery
I am getting an error on [variable not defined] on tbHorseID
Any help please!!..............Bob

Bob V said:
YES YES YES I got it
recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 AND Invoicing = True
ORDER BY OwnerID ", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
:) :) :) .........................Bob

Bob V said:
Ok Ive worked out it must be [subSetInvoiceValues] so somewhere I have to
add Invocing = True
This is part of the subSetInvoiceValues that needs changing
Thanks if you can help............Bob


recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 ORDER BY OwnerID ",
CurrentProject.Connection, adOpenDynamic, adLockOptimistic


Bob V said:
In tblHorseDetails I have a 4 Fields
[HorseID] Number
[OwnerID] Number
[OwnerPercent] Number
[Invocing] Yes/No, (Check Box)
Effectively you set your horse up with one or more Owners with there
percent in that 1 Horse
I am trying to do is that when that record has a False in Invoicing it
will not create an Invoice
Below is the Code for Distributing the Invoice at the end of the month
Or do you think it has to been done in subSetInvoiceValues 16 row down
Any help would be much appreciated...............Bob

Private Sub cmdSave_Click()
With recInvoice
Dim recHorseOwners As New ADODB.Recordset, dblOwnerPercentAmount
As Double
Dim dblTotal As Double, dblGSTContentsValue As Double

recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM
tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 ORDER BY OwnerID
", CurrentProject.Connection, adOpenDynamic, adLockOptimistic

If recHorseOwners.EOF = True And recHorseOwners.BOF = True Then
recHorseOwners.Close
Set recHorseOwners = Nothing
MsgBox "This Horse Has No Client Select, [CLOSE] " & vbCrLf &
vbCrLf & " Go to Horses and enter a Client before Distributing.",
vbApplicationModal + vbNo + vbInformation
Exit Sub
End If

If MsgBox("Do You Want To Distribute?", vbQuestion +
vbApplicationModal + vbYesNo + vbDefaultButton1, "Intellisoft") = vbYes
Then
recInvoice.AddNew
subSetInvoiceValues
recInvoice.Update


subDeleteInvoiceItmdt

subBlankForm
lbOwnerlist1.value = ""
lbOwnerlist1.RowSource = ""

lbOwnerlist1.SetFocus
cmdSave.Enabled = False
bModify = False
End If

Forms!frmModify![lstModify] = Null
Form_frmModify.lstModify.Requery
End With
 
B

Bob V

Thanks Guys All DONE (Funniest Post Ever)
Had the wrong Code, Did it all myself :) :) :)
Regards Bob

Bob V said:
When I distribute 1 Invoice at a time it works PERFECTLY but when I use
this other control code which Distributes all my Invoices at once:
If nRtnValue = vbYes Then
DoCmd.Hourglass True
subSetInvoiceValues
Application.SysCmd acSysCmdSetStatus, "Process is completed."
Application.SysCmd acSysCmdClearStatus
DoCmd.Hourglass False
Me.lstModify.Requery
I am getting an error on [variable not defined] on tbHorseID
Any help please!!..............Bob

Bob V said:
YES YES YES I got it
recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 AND Invoicing =
True ORDER BY OwnerID ", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
:) :) :) .........................Bob

Bob V said:
Ok Ive worked out it must be [subSetInvoiceValues] so somewhere I have
to add Invocing = True
This is part of the subSetInvoiceValues that needs changing
Thanks if you can help............Bob


recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 ORDER BY OwnerID
", CurrentProject.Connection, adOpenDynamic, adLockOptimistic


In tblHorseDetails I have a 4 Fields
[HorseID] Number
[OwnerID] Number
[OwnerPercent] Number
[Invocing] Yes/No, (Check Box)
Effectively you set your horse up with one or more Owners with there
percent in that 1 Horse
I am trying to do is that when that record has a False in Invoicing it
will not create an Invoice
Below is the Code for Distributing the Invoice at the end of the month
Or do you think it has to been done in subSetInvoiceValues 16 row down
Any help would be much appreciated...............Bob

Private Sub cmdSave_Click()
With recInvoice
Dim recHorseOwners As New ADODB.Recordset, dblOwnerPercentAmount
As Double
Dim dblTotal As Double, dblGSTContentsValue As Double

recHorseOwners.Open "SELECT OwnerID,OwnerPercent FROM
tblHorseDetails" _
& " WHERE HorseID=" _
& val(tbHorseID.value) & " AND OwnerID > 0 ORDER BY OwnerID
", CurrentProject.Connection, adOpenDynamic, adLockOptimistic

If recHorseOwners.EOF = True And recHorseOwners.BOF = True Then
recHorseOwners.Close
Set recHorseOwners = Nothing
MsgBox "This Horse Has No Client Select, [CLOSE] " & vbCrLf
& vbCrLf & " Go to Horses and enter a Client before Distributing.",
vbApplicationModal + vbNo + vbInformation
Exit Sub
End If

If MsgBox("Do You Want To Distribute?", vbQuestion +
vbApplicationModal + vbYesNo + vbDefaultButton1, "Intellisoft") = vbYes
Then
recInvoice.AddNew
subSetInvoiceValues
recInvoice.Update


subDeleteInvoiceItmdt

subBlankForm
lbOwnerlist1.value = ""
lbOwnerlist1.RowSource = ""

lbOwnerlist1.SetFocus
cmdSave.Enabled = False
bModify = False
End If

Forms!frmModify![lstModify] = Null
Form_frmModify.lstModify.Requery
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top