How to Add Records to Table with TxtBox Control on Form (1 Viewer)

shiznaw

Registered User.
Local time
Yesterday, 22:22
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
 

MarkK

bit cruncher
Local time
Yesterday, 22:22
Joined
Mar 17, 2004
Messages
8,197
There's nothing obvious wrong with it, but ultimately you need to tell us if it works. Run it. Does it work? :)
 

shiznaw

Registered User.
Local time
Yesterday, 22:22
Joined
Feb 3, 2016
Messages
18
I get scared trying my own stuff at work. Stuff blows up. It worked...this time.
 

Users who are viewing this thread

Top Bottom