G
Guest
I am trying to add a new record to a table using a form.
Using my code a new record is added but not the data that is entered into
the text/combo box but the variable is. Can someome tell me what is wrong
with my code? I appreciate any help.
Private Sub Command42_Click()
Dim dbsFairhavendb2 As Database
Dim rstINVENTORY_T As recordset
Dim strVENDOR_NAME As String
Set dbsFairhavendb2 = OpenDatabase("Fairhavendb2.mdb")
Set rstINVENTORY_T = _
dbsFairhavendb2.OpenRecordset("INVENTORY_T")
With rstINVENTORY_T
.AddNew '
!VENDOR_NAME = "strVENDOR_NAME"
.UpDate
.Bookmark = .LastModified
MsgBox "New Record Added" '
End With
dbsFairhavendb2.Close
End Sub
When I open the table strVENDOR_NAME is in the field instead of a name of a
vendor that has been entered into the form box. ex: New England Seafood
Using my code a new record is added but not the data that is entered into
the text/combo box but the variable is. Can someome tell me what is wrong
with my code? I appreciate any help.
Private Sub Command42_Click()
Dim dbsFairhavendb2 As Database
Dim rstINVENTORY_T As recordset
Dim strVENDOR_NAME As String
Set dbsFairhavendb2 = OpenDatabase("Fairhavendb2.mdb")
Set rstINVENTORY_T = _
dbsFairhavendb2.OpenRecordset("INVENTORY_T")
With rstINVENTORY_T
.AddNew '
!VENDOR_NAME = "strVENDOR_NAME"
.UpDate
.Bookmark = .LastModified
MsgBox "New Record Added" '
End With
dbsFairhavendb2.Close
End Sub
When I open the table strVENDOR_NAME is in the field instead of a name of a
vendor that has been entered into the form box. ex: New England Seafood