Hi,
I'm having the referencing problem.Cant figure out how to equate the textbox> txtResult1 on the my form with the Field > Hisse , from the Query > Select_MaxWgt .
Here's my code for the Calc button:
Private Sub cmdCalc_Click()
Dim Bank As Variant
DoCmd.RunCommand acCmdSaveRecord
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim i As Byte
Dim MaxVal As Double
Set dbs = CurrentDb
Set rst = dbs.OpenRecordSet("tblWgtFactors")
MaxVal = 0
For i = 0 To 11
If rst.Fields(i) > MaxVal Then MaxVal = rst.Fields(i)
Next i
rst.Close
Set rst = dbs.OpenRecordSet("tblMax_Weight")
rst.Edit
rst.Fields(0) = MaxVal
rst.Update
rst.Close
DoCmd.OpenQuery "Select_MaxWght"
Form!txtResult1 = [Select_MaxWght]![Hisse]
Last two lines , where i have problem...
I'm having the referencing problem.Cant figure out how to equate the textbox> txtResult1 on the my form with the Field > Hisse , from the Query > Select_MaxWgt .
Here's my code for the Calc button:
Private Sub cmdCalc_Click()
Dim Bank As Variant
DoCmd.RunCommand acCmdSaveRecord
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim i As Byte
Dim MaxVal As Double
Set dbs = CurrentDb
Set rst = dbs.OpenRecordSet("tblWgtFactors")
MaxVal = 0
For i = 0 To 11
If rst.Fields(i) > MaxVal Then MaxVal = rst.Fields(i)
Next i
rst.Close
Set rst = dbs.OpenRecordSet("tblMax_Weight")
rst.Edit
rst.Fields(0) = MaxVal
rst.Update
rst.Close
DoCmd.OpenQuery "Select_MaxWght"
Form!txtResult1 = [Select_MaxWght]![Hisse]
Last two lines , where i have problem...