|
-
July 10th, 2000, 09:35 AM
#1
Connection Ojbect
Can anyone help me with the following code? I'm getting, "Invalid use of New keyword", when I try to run it. Thanks so much for your help!
Private Sub cmdSubmit_Click()
Dim cnBusinessRule As Connection
Dim sSQL As String
Set cnBusinessRule = New Connection
'Establish a connection
With cnBusinessRule
.Provider = "Microsoft.Jet.OLEDB.3.51"
.ConnectionString = "User ID = sa; password=;" & _
"Data Source=C:\BusinessRules\Database\BusinessRule.mdb;" & _
"Initial Catalog=BusinessRule"
.Open
End With
sSQL = "INSERT INTO GOV_AUTHORITY(Name, Category) " & _
"VALUES (txtName, cmbCategory)"
cnBusinessRule.Execute sSQL
cnBusinessRule.Close
Set cnBusinessRule = Nothing
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|