Run time Error 2147467259 Could Not Find File

chris80

New member
Local time
Today, 05:17
Joined
Dec 14, 2006
Messages
2
Hi
I am running Access 2000 with MDAC 2.8 and SQL Server 2000 database. I have linked the tables of the database in Access. The problem is that it would not allow me to insert/update/delete but only to select from the database.

Here is the code:
Dim strSQL As String
Dim con As ADODB.Connection
Dim cmd As ADODB.Command

Set con = CurrentProject.Connection
Set cmd = New ADODB.Command

Set cmd.ActiveConnection = con

strSQL = " INSERT INTO dbo.crop_demand_yearly (" & _
"geo_id, crop, area, water_value, water_use, date_from, date_to)" & _
" VALUES("

strSQL = strSQL & ((Val(Me.txt_borenid))) & "," & (Val(Me.cbo_crop)) & "," & (Me.txt_area) & "," & (Me.txt_use) & "," & (Me.txt_value) & ",'" & Format(Me.txt_datefrom, "dd/MM/yyyy") & "','" & Format(Me.txt_dateto, "dd/MM/yyyy") & "')"


cmd.CommandText = strSQL

cmd.Execute strSQL


con.Close
Set cmd = Nothing
Set con = Nothing

I dont understand what is the problem! Please help
 
Do you have edit/append/write rights to the table? Can you insert a record into the table in the table view?

It's too late at night for me to build your table and test your SQL string. (You) should use a breakpoint to see verify the value of your constructed SQL string.

I assume that you haven't done that because you didn't post it.
 

Users who are viewing this thread

Back
Top Bottom