J
jermaine123 via AccessMonster.com
Hello Guys,
I have modified the order details form in Northwind 2007 and I am having an
issue I hope you can help me with. It is a form with a dataaheet that you use
to enter line items into a transaction. Each row contains the fields ITEMNAME,
QUANTITY PRICE, DISCOUNT, SUBTOTAL, BENEFIT TYPE.
Each line item in a transaction should be assigned to a particular benefit
type. I have a piece of code that goes through the data sheet and checks to
make sure that the benefit type field is not empty.
The problem I am having is that if I enter 3 items and dont put a benefit
type for any of them,- When I click the COMPLETE TRANSACTION button I will
get the message box "You need to enter a benefit type".
If I put in the benefit type for one of the three items and click the
COMPLETE TRANSACTION button again, I do not get the error message box again,
instead it closes the transaction.
Each time I click the COMPLETE TRANSACTION button I would like it to go
through each line item and check if it has a benefit type entered and if not
show a mesage box.
Hope my post makes sense. I am sure it is something simple, but I am just not
seeing it.
Thanks
The code is below....
Dim rsw As New RecordsetWrapper
With rsw.GetRecordsetClone(Me.sbfOrderDetails.Form.Recordset)
' Check that we have at least one specified line items
If .RecordCount = 0 Then
MsgBoxOKOnly OrderDoesNotContainLineItems
Else
Dim LineItemCount As Integer
LineItemCount = 0
While Not .EOF
LineItemCount = LineItemCount + 1
If IsNull(Forms![Order Details]![sbfOrderDetails].Form![Product
ID]) Then
MsgBoxOKOnly MustSpecifyItemName
Exit Function
ElseIf IsNull(Forms![Order Details]![sbfOrderDetails].Form!
[Benefit ID]) Then
MsgBoxOKOnly MustSpecifyBenefitType
Exit Function
End If
rsw.MoveNext
Wend
ValidateOrder = True
eh.TryToSaveRecord
Me![Status ID] = Closed_CustomerOrder
MsgBoxOKOnly OrderMarkedClosed
SetFormState
End If
End With
I have modified the order details form in Northwind 2007 and I am having an
issue I hope you can help me with. It is a form with a dataaheet that you use
to enter line items into a transaction. Each row contains the fields ITEMNAME,
QUANTITY PRICE, DISCOUNT, SUBTOTAL, BENEFIT TYPE.
Each line item in a transaction should be assigned to a particular benefit
type. I have a piece of code that goes through the data sheet and checks to
make sure that the benefit type field is not empty.
The problem I am having is that if I enter 3 items and dont put a benefit
type for any of them,- When I click the COMPLETE TRANSACTION button I will
get the message box "You need to enter a benefit type".
If I put in the benefit type for one of the three items and click the
COMPLETE TRANSACTION button again, I do not get the error message box again,
instead it closes the transaction.
Each time I click the COMPLETE TRANSACTION button I would like it to go
through each line item and check if it has a benefit type entered and if not
show a mesage box.
Hope my post makes sense. I am sure it is something simple, but I am just not
seeing it.
Thanks
The code is below....
Dim rsw As New RecordsetWrapper
With rsw.GetRecordsetClone(Me.sbfOrderDetails.Form.Recordset)
' Check that we have at least one specified line items
If .RecordCount = 0 Then
MsgBoxOKOnly OrderDoesNotContainLineItems
Else
Dim LineItemCount As Integer
LineItemCount = 0
While Not .EOF
LineItemCount = LineItemCount + 1
If IsNull(Forms![Order Details]![sbfOrderDetails].Form![Product
ID]) Then
MsgBoxOKOnly MustSpecifyItemName
Exit Function
ElseIf IsNull(Forms![Order Details]![sbfOrderDetails].Form!
[Benefit ID]) Then
MsgBoxOKOnly MustSpecifyBenefitType
Exit Function
End If
rsw.MoveNext
Wend
ValidateOrder = True
eh.TryToSaveRecord
Me![Status ID] = Closed_CustomerOrder
MsgBoxOKOnly OrderMarkedClosed
SetFormState
End If
End With