Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to save information on unbound textboxes in a form 1

Status
Not open for further replies.

Eliasgitau

IS-IT--Management
Feb 19, 2008
11
KE
Dear Learned Friends,
I would like to anyone to help on how to save data from unbounded textboxes in a form. eg. calculated fields.

Regards,
EliasGitau
 
You do not save calculated fields in a table. See:
Fundamentals of Relational Database Design

But if you decide to go against the protocols of relational databases, then you can use a recordset. To get you started, here's some incomplete code:

Private Sub Text126_AfterUpdate()
Dim db As Dao.Database
Dim rs As Dao.Recordset
Dim strWhere As String

Set db = CurrentDb()
Set rs = db.OpenRecordset("MMCMainTable", dbOpenDynaset)
strWhere = "[MMCNumber] = " & Chr(34) & Me![MMCNumber] & Chr(34)
rs.FindFirst strWhere
If rs.NoMatch Then
MsgBox "No match found"
Else
rs.Edit
rs![PlatNum] = Me![estv]
rs.Update
End If
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End Sub

So you would use either rs.Edit, rs.AddNew depending on the case.

Again, saving calculations isn't a good thing.
 
Or use and append query..

Agreeing with fneily ... Don't save calculated fields

Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top