I'm having the referencing problem , Equate textbox to Form

Gurbo

New member
Local time
Today, 08:25
Joined
Jan 13, 2003
Messages
8
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...
 
Just use a DLookup:


Form!txtResult1 = dlookup("Hisse","Select_MaxWght")
 
That works & rocks :)

Thnx mate ,
 

Users who are viewing this thread

Back
Top Bottom