How to Add Records to Table with TxtBox Control on Form

shiznaw

Registered User.
Local time
Today, 02:18
Joined
Feb 3, 2016
Messages
18
Question:
Frm "Match Summary" isn't bound to any Records (Table, Query).
TxTBox "Parameters" is unbound as well. I need to give the End-User an ability to add information to Table "Parameters"​

My VBA Solution:
Since Frm isn't bound, [DoCmd.GoToRecord , "Parameter", acNewRec] won't work.
My Question is whether this code Works:
Code:
Private Sub CmdBtn2_Click()
Dim db As Database
Dim rst As DAO.Recordset

Dim strsql As String

Set db = CurrentDb()
Set rst = db.OpenRecordset("parameter", dbOpenDynaset)

With rst
.AddNew
!Text = Me.TxtParamtrs.Value
.Update
End With
End Sub
 
There's nothing obvious wrong with it, but ultimately you need to tell us if it works. Run it. Does it work? :)
 
I get scared trying my own stuff at work. Stuff blows up. It worked...this time.
 

Users who are viewing this thread

Back
Top Bottom