S
stu dongel
hello there
i am having trouble apending data to a table with vb code, i think my syntax
may be off with dao or something,
what i am trying to do is this, when you click cmd button it simply adds the
value of txtUserName to a table called tblUserTracking to the field
UserName. when i click the command button nothing happens, no error, no
appending of data to the table, does anyone se what wrong with this code?
Private Sub Command10_Click()
Dim wspJet As DAO.Workspace
Dim dbsCurrent As DAO.Database
Dim rstWrite As DAO.Recordset
Set wspJet = DBEngine.Workspaces(0)
Set MyDB = CurrentDb
Set rstWrite = MyDB.OpenRecordset("tblUserTracking", dbOpenDynaset,
dbAppendOnly)
wspJet.BeginTrans
rstWrite.AddNew
rstWrite!UserName = txtUserName.Value
rstWrite.Update
End Sub
thanks in advance
stu
i am having trouble apending data to a table with vb code, i think my syntax
may be off with dao or something,
what i am trying to do is this, when you click cmd button it simply adds the
value of txtUserName to a table called tblUserTracking to the field
UserName. when i click the command button nothing happens, no error, no
appending of data to the table, does anyone se what wrong with this code?
Private Sub Command10_Click()
Dim wspJet As DAO.Workspace
Dim dbsCurrent As DAO.Database
Dim rstWrite As DAO.Recordset
Set wspJet = DBEngine.Workspaces(0)
Set MyDB = CurrentDb
Set rstWrite = MyDB.OpenRecordset("tblUserTracking", dbOpenDynaset,
dbAppendOnly)
wspJet.BeginTrans
rstWrite.AddNew
rstWrite!UserName = txtUserName.Value
rstWrite.Update
End Sub
thanks in advance
stu