I have a form (OfficeSupplies_frm) and subform (OfficeSupplies_sfrm) that I use in keeping track of office supply orders.
My problem is that I am trying to get the subform clear the Order and Qty fields so I do not have double orders.
While the below program works great when the subform is open by itself, when I open the form it clears only the first item in the subform.
The form consists of ITEM and ItemID
The subform consists of ORDER, QTY, ITEM#, ITEM, DESCRIPTION
This is where if I have one Item (I.E. Batteries) I might have many Items
(AA, AAA, C, D, and 9V) So the subform will only show those items that go with the Form's ITEM.
Here is the program as it stands now.
Private Sub Form_Load()
On Err GoTo Oops
Dim db As Database
Dim rs As Recordset
Dim Counter As Integer
Dim Clear
Set db = CurrentDb
Set rs = Me.RecordsetClone
Me.Recordset.MoveLast
Counter = Me.Recordset.RecordCount
[Order].SetFocus
Do While Counter > 0
DoCmd.FindRecord -1
[Order] = 0
Me.Qty = Clear
DoCmd.FindNext
Counter = Counter - 1
Loop
Me.Recordset.MoveFirst
Get_Out:
Exit Sub
Oops:
MsgBox Err.DESCRIPTION
Resume Get_Out
End Sub
I have it under "On Load" in the subform.
Thank you for your time and help in this matter.
Robert M
My problem is that I am trying to get the subform clear the Order and Qty fields so I do not have double orders.
While the below program works great when the subform is open by itself, when I open the form it clears only the first item in the subform.
The form consists of ITEM and ItemID
The subform consists of ORDER, QTY, ITEM#, ITEM, DESCRIPTION
This is where if I have one Item (I.E. Batteries) I might have many Items
(AA, AAA, C, D, and 9V) So the subform will only show those items that go with the Form's ITEM.
Here is the program as it stands now.
Private Sub Form_Load()
On Err GoTo Oops
Dim db As Database
Dim rs As Recordset
Dim Counter As Integer
Dim Clear
Set db = CurrentDb
Set rs = Me.RecordsetClone
Me.Recordset.MoveLast
Counter = Me.Recordset.RecordCount
[Order].SetFocus
Do While Counter > 0
DoCmd.FindRecord -1
[Order] = 0
Me.Qty = Clear
DoCmd.FindNext
Counter = Counter - 1
Loop
Me.Recordset.MoveFirst
Get_Out:
Exit Sub
Oops:
MsgBox Err.DESCRIPTION
Resume Get_Out
End Sub
I have it under "On Load" in the subform.
Thank you for your time and help in this matter.
Robert M