Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27203

MS ActiveX Data Objects 6.0 Libary *Missing*

$
0
0
Hi Guys,

Wondering if you could help im having some issues getting some VB script to function properly on my work computer. I wrote it and got it to work on my personal laptop running Office 2012 / Vista. Having transferred the file to my work machine running office 2003 / xp on a novell network its not behaving itself as the Data Objects 6.0 Libary is missing. Does anyone know of a work around? The code is being used to transfer information straight from a completed form and onto an excel chart. Code shown below.


Public cnn As New ADODB.Connection

Sub ConnectDB()


If cnn.State <> adStateOpen Then

Dim strFileName As String

strFileName = [ConfigPath].Value

cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strFileName & ";" & _
"Extended Properties=""Excel 8.0;HDR=Yes"";"

End If

End Sub


Sub CopyData()

ConnectDB

Dim rst As New ADODB.Recordset
Dim CurrentID As Long
Dim vbResult As VbMsgBoxResult

rst.Open "SELECT * FROM [Database];", cnn, adOpenStatic, adLockReadOnly

If Not rst.EOF Then
rst.MoveLast
CurrentID = rst("RefNumber")
CurrentID = CurrentID + 1
Else
CurrentID = 1
End If

Dim sql As String

sql = "Insert into [Database] (refnumber, surname, FirstName, EthnicOrigin, DOB, School, Address, Postcode, ReferrerEmail) values('" & _
CurrentID & "','" & [FormSurname] & "','" & [FormFirstName] & "','" & [FormEthnic] & "','" & [FormDOB] & "','" & [FormSchool] & "','" & _
[FormAddress] & "','" & [FormPostCode] & "','" & [FormEmail] & "')"



cnn.Execute (sql)

MsgBox "Record Saved to Database"

DisconnectDB

End Sub

Sub DisconnectDB()

If cnn.State <> adStateClosed Then

cnn.Close
Set cnn = Nothing

End If


End Sub


Thanks!!

Viewing all articles
Browse latest Browse all 27203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>