julian_morgan
New member
- Local time
- Today, 10:53
- Joined
- Apr 15, 2010
- Messages
- 9
Hi All,
Really stuck on this one! gonna Loose my job if not careful :-( :banghead:
I have a form (FrmMachines) with a five page tab contol.
I have a subform on each page which are all identical except that they each show a datasheet of records for a different machine number 1-5. (FrmMC1Sub, 2 ,3 ,4, 5).
On each record in the subform there are two buttons:-
MarkCut: updates a tickbox in the parent table and refreshes the form tabs.
Move: changes the value of [machine] in the parent table from a value chosen from a combo box called moveitem.
The code works on the first tab but when i change to another tab, it falls over. It says runtime error 2424 - the expression you entered has a field, control or property name that access cant find.
I'm aware that tabs may need to be referenced in different ways so have tried various different referencing methods, but nothing seemed to work.
I have also tried removing the tabs in favour of one form with buttons for each machine that change the source of the subform but i get exactly the same problem.
Also i cant seem to find the right way to refresh all tab pages/current tab page.
Heres my code for the two buttons:-
Many thanks in advance!
Jools:banghead:
------------------------------------------
Private Sub MarkCut_Click()
Dim str As String
Dim Ord As String
Dim Quant As String
Ord = Me!Order.Value
Quant = Me!Qty.Value
str = "UPDATE SundryItems SET CuttingCompleted = True WHERE Order_Number = " + Ord + " And Qty = " + Quant
DoCmd.RunSQL str
MsgBox "Order Line Marked As Cut", , "Action Successful !"
Forms!FrmMachines!FrmMC1Sub.Form.Requery
End Sub
------------------------------------------------------------------------
Private Sub Move_Click()
Dim str As String
Dim Dest As String
Dim Ord As String
Dim Quant As String
Dest = Me.MoveItem.Column(0)
Ord = Me!Order.Value
Quant = Me!Qty.Value
DoCmd.SetWarnings False
str = "UPDATE SundryItems SET Machine = " + Dest + " WHERE Order_Number = " + Ord + " And Qty = " + Quant
DoCmd.RunSQL str
MsgBox "Order Line Moved To Machine" & " " & Dest, , "Action Successful !"
Forms!FrmMachines!FrmMC1Sub.Form.Requery
DoCmd.SetWarnings True
End Sub
Really stuck on this one! gonna Loose my job if not careful :-( :banghead:
I have a form (FrmMachines) with a five page tab contol.
I have a subform on each page which are all identical except that they each show a datasheet of records for a different machine number 1-5. (FrmMC1Sub, 2 ,3 ,4, 5).
On each record in the subform there are two buttons:-
MarkCut: updates a tickbox in the parent table and refreshes the form tabs.
Move: changes the value of [machine] in the parent table from a value chosen from a combo box called moveitem.
The code works on the first tab but when i change to another tab, it falls over. It says runtime error 2424 - the expression you entered has a field, control or property name that access cant find.
I'm aware that tabs may need to be referenced in different ways so have tried various different referencing methods, but nothing seemed to work.
I have also tried removing the tabs in favour of one form with buttons for each machine that change the source of the subform but i get exactly the same problem.
Also i cant seem to find the right way to refresh all tab pages/current tab page.
Heres my code for the two buttons:-
Many thanks in advance!
Jools:banghead:
------------------------------------------
Private Sub MarkCut_Click()
Dim str As String
Dim Ord As String
Dim Quant As String
Ord = Me!Order.Value
Quant = Me!Qty.Value
str = "UPDATE SundryItems SET CuttingCompleted = True WHERE Order_Number = " + Ord + " And Qty = " + Quant
DoCmd.RunSQL str
MsgBox "Order Line Marked As Cut", , "Action Successful !"
Forms!FrmMachines!FrmMC1Sub.Form.Requery
End Sub
------------------------------------------------------------------------
Private Sub Move_Click()
Dim str As String
Dim Dest As String
Dim Ord As String
Dim Quant As String
Dest = Me.MoveItem.Column(0)
Ord = Me!Order.Value
Quant = Me!Qty.Value
DoCmd.SetWarnings False
str = "UPDATE SundryItems SET Machine = " + Dest + " WHERE Order_Number = " + Ord + " And Qty = " + Quant
DoCmd.RunSQL str
MsgBox "Order Line Moved To Machine" & " " & Dest, , "Action Successful !"
Forms!FrmMachines!FrmMC1Sub.Form.Requery
DoCmd.SetWarnings True
End Sub