hi
i 'm writng a code using msaccess with odbc.
my dsn name is htgry
i want to insert data eneterd in text fields to a table named qwer on clicking a command button.
code as follows
Private Sub Command14_Click()
Dim dbLocation 'Location of our Access database file
Dim sSQL 'Our SQL query
dbLocation = "C:\Documents and Settings\Administrator\Desktop"
Set objADO = dbLocation.CreateObject("ADODB.Connection") 'Create an ADO connection to a database //// line1
objADO.Open "htgry" //// line2
objADO.Open dbLocation 'Open the database
sSQL = "INSERT INTO qwer ( name , amount ) VALUES('" & Text7 & "' , '" & Text9 & "')" 'Set our SQL query
objADO.Execute (sSQL) 'Execute this SQL query
objADO.Close
Set objADO = Nothing
End Sub
it is not being executed and error is "object not defined " at line 1 and line 2
kindly make me complete this programme error free.
with anticipation