I seem to be answering a lot of my own questions lately.
I got rid of the datagrid and added data to my records with the following code: (Blue code at end)
Private Sub cmdCalculate_Click()
For Index = 1 To Text1.Count - 1
Text1(Index).Locked = True
Next Index
y = 0
z = 0
For y = 1 To txtOutputFormula.Count - 1
For z = 1 To Text1.Count - 1
startpos = InStr(1, txtOutputFormula(y).Text, "[" & Text1(z).Tag & "]")
If startpos > 0 Then
tempstr = Replace(txtOutputFormula(y).Text, "[" & Text1(z).Tag & "]", Text1(z).Text)
'MsgBox tempstr
txtOutputFormula(y).Text = tempstr
End If
' MsgBox "[" & Text1(z).Tag & "]"
Next z
Next y
For p = 1 To txtResult.Count - 1
txtResult(p).Text = ScriptControl1.Eval(txtOutputFormula(p))
txtResult(p).Visible = True
Next p
For Index = 1 To Text1.Count - 1
Text1(Index).Enabled = False
Next Index
cmdCalculate.Enabled = False
Set db = DBEngine.Workspaces(0).OpenDatabase(App.Path & "\products.mdb")
Set rstrecordset = db.OpenRecordset("SELECT * FROM tblReport", dbOpenDynaset)
For loopy = 1 To txtOutputNumberOfCuts.Count - 1
rstrecordset.AddNew
rstrecordset.Fields(0) = txtOutputName(loopy)
rstrecordset.Fields(1) = txtOutputNumberOfCuts(loopy)
rstrecordset.Fields(2) = txtResult(loopy)
rstrecordset.Update
Next loopy
rstrecordset.Close
Set rstrecordset = Nothing
db.Close
Set db = Nothing
End Sub
Enter your message below
Sign in or Join us (it's free).