Hello me again! lol
I need some help, would you epect anything different :rolleyes:
I am trying to insert some data in to a Access 2000 file with the following code:
Dim line_string As String
Dim sex_string As String
Dim tel_number_string As String
Dim callers_name_String As String
Dim callers_location_string As String
Dim topic1_string As String
Dim topic2_string As String
Dim graphic1_string As String
Dim time_called_string As String
line_string = ComboBox1.Text
sex_string = ComboBox2.Text
tel_number_string = TextBox1.Text
callers_name_String = TextBox2.Text
callers_location_string = TextBox3.Text
topic1_string = TextBox4.Text
topic2_string = TextBox5.Text
graphic1_string = ComboBox3.Text
time_called_string = Date.Now.ToString("T")
Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & database)
MyConnection.Open()
Dim MyCommand As New OleDbCommand("INSERT INTO Callers_View (ID, Line_Number, Sex, Tel_Number, Callers_Name, Callers_Location, Topic1, Topic2, Graphic1, Time_Called) VALUES ( '2' , 'line_string' , 'sex_string' , 'tel_number_string' , 'callers_name_String' , 'callers_location_string' , 'topic1_string' , 'topic2_string' , 'graphic1_string' , 'time_called_string')", MyConnection)
MyConnection.Close()
MyCommand.Dispose()
database is already declared as a string for the form.
I check the properties of the access file and it has not been accessed nor is anything being stored in it.
What am i doing wrong?
ID is set to be Autonumber and a PrimaryKey. I have attached a copy of the database to let you see what I mean.
Thanks for your help again guys and gals. It is much appreciated.
Chris psDOTnet.zip