Dear All,
Have this problem as is seen on the attached JPG. On the subform weights are displayed from the a table and a calculation. This is transferred into the table by a Material list, which pops up a form with choices. When one of the buttons is pressed the following code will run.
My problem is that I want to deduct 1% from the weight of the first transaction, this is to compensate for any dirt on the material being bought. Currently the form works fine but as you can see the Empty weight of the first transaction doesn't match the weight of the Full weight of the second transaction and I have no clue where to switch.
The way I do this now doesn't work because try to handle the 1% in Text boxes. I will attach the program of which I only use the forms frmTouchscreen, frmMultiTouchscreen and the popup frmMultiMaterial which contains the above code. The command button Read Scale reads a file that comes from a wedge to grab the weight from a scale. Weigh Out registers the weight when a lorry comes back after (partially) unloading.
In the above code there is also data transferred to a sales table in which case no % should be deducted as this is clean material
Any help much appriciated..
Have this problem as is seen on the attached JPG. On the subform weights are displayed from the a table and a calculation. This is transferred into the table by a Material list, which pops up a form with choices. When one of the buttons is pressed the following code will run.
Code:
Private Sub SelectMe(Ctl As String)
'/Before we simply displayed the selection on the previous screen
'/What we are doing now is adding the selection to the TblDocketMaterials Table
Dim rs As DAO.Recordset
If Forms!frmMultiTouchscreen!Sale = False Then
Set rs = CurrentDb.OpenRecordset("Select * From TblDocketBuy Where DocId = " & LngDocket & " And CatID = " & Me(Ctl).Tag & " And MatID = " & LngMaterial & " And F_Weight = " & LngWeight & " And B_Price = " & LngBuy & " And Dirt = " & LngDirt)
Else
Set rs = CurrentDb.OpenRecordset("Select * From TblDocketSell Where DocId = " & LngDocket & " And CatID = " & Me(Ctl).Tag & " And MatID = " & LngMaterial & " And F_Weight = " & LngWeight & " And B_Price = " & LngBuy)
End If
If Not rs.EOF And Not rs.BOF Then
'/selection already exists for this docket - don't want duplicates
Else
rs.AddNew
rs("DocID") = LngDocket
rs("MatID") = LngMaterial
rs("CatID") = Me(Ctl).Tag
rs("F_Weight") = LngWeight
'Rs("E_Weight") = LngEmpty
rs("B_Price") = LngBuy
rs("Dirt") = LngDirt
rs.Update
rs.Close
End If
Set rs = Nothing
DoCmd.Close
End Sub
My problem is that I want to deduct 1% from the weight of the first transaction, this is to compensate for any dirt on the material being bought. Currently the form works fine but as you can see the Empty weight of the first transaction doesn't match the weight of the Full weight of the second transaction and I have no clue where to switch.
The way I do this now doesn't work because try to handle the 1% in Text boxes. I will attach the program of which I only use the forms frmTouchscreen, frmMultiTouchscreen and the popup frmMultiMaterial which contains the above code. The command button Read Scale reads a file that comes from a wedge to grab the weight from a scale. Weigh Out registers the weight when a lorry comes back after (partially) unloading.
In the above code there is also data transferred to a sales table in which case no % should be deducted as this is clean material
Any help much appriciated..