May 23, 2005 at 10:01 am
I'm moving over to SQL from Access and I'm trying to add a new data to a combo box in a form. The form is in an access 2000 access data project working from a SQL 2000 database. It worked fine in the original access db.
This is the code that I'm currently using.
Private Sub Subject_NotInList(NewData As String, Response As Integer)
Dim db As Database
If (MsgBox("Do you want to add """ & NewData & """ to the list of subjects?", 36, "New Subject") = 6) Then
Set db = DBEngine.Workspaces(0).Databases(0)
db.Execute "INSERT INTO Subjects (Subject) VALUES (""" & NewData & """);"
Response = DATA_ERRADDED
Else
Response = DATA_ERRDISPLAY
End If
End Sub
hope someone can help.
May 23, 2005 at 1:50 pm
What error are you getting? And you may want to check your use of single and double quotes.
I wasn't born stupid - I had to study.
May 24, 2005 at 1:55 am
Change the line of code as follows:
db.Execute "INSERT INTO Subjects (Subject) Values ('" & Newdata & "')"
ie ( ' " & newdata & " ' ) "
Richard
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy