J
joao
Hi
i got this code from a web site and its working, i just need to inser
the password of my database and i really don't know where it shoul
go.
Anyone could help?
Written : 23-May-2003 by Andy Wiggins - Byg Software Ltd
Function DbSource()
DbSource = ThisWorkbook.Path & "/bdalunosindex.mdb"
End Function
Function DbConnection()
DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=
& DbSource & ";"
End Function
Sub SelectAndReturnRecordsADO()
Dim cnn As ADODB.Connection
Dim rstRecordset As ADODB.Recordset
Dim cmdCommand As ADODB.Command
Dim numberOfRows
Dim vtSql
Dim c As Field
'' Open the connection.
Set cnn = New ADODB.Connection
cnn.Open DbConnection
'' Set the command text.
Set cmdCommand = New ADODB.Command
Set cmdCommand.ActiveConnection = cnn
vtSql = " SELECT * FROM Pagamento ORDER BY Pagamento.c_Contrato"
With cmdCommand
.CommandText = vtSql
.CommandType = adCmdText
.Execute
End With
'' Open the recordset.
Set rstRecordset = New ADODB.Recordset
Set rstRecordset.ActiveConnection = cnn
rstRecordset.Open cmdCommand
rstRecordset.MoveFirs
i got this code from a web site and its working, i just need to inser
the password of my database and i really don't know where it shoul
go.
Anyone could help?
Written : 23-May-2003 by Andy Wiggins - Byg Software Ltd
Function DbSource()
DbSource = ThisWorkbook.Path & "/bdalunosindex.mdb"
End Function
Function DbConnection()
DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=
& DbSource & ";"
End Function
Sub SelectAndReturnRecordsADO()
Dim cnn As ADODB.Connection
Dim rstRecordset As ADODB.Recordset
Dim cmdCommand As ADODB.Command
Dim numberOfRows
Dim vtSql
Dim c As Field
'' Open the connection.
Set cnn = New ADODB.Connection
cnn.Open DbConnection
'' Set the command text.
Set cmdCommand = New ADODB.Command
Set cmdCommand.ActiveConnection = cnn
vtSql = " SELECT * FROM Pagamento ORDER BY Pagamento.c_Contrato"
With cmdCommand
.CommandText = vtSql
.CommandType = adCmdText
.Execute
End With
'' Open the recordset.
Set rstRecordset = New ADODB.Recordset
Set rstRecordset.ActiveConnection = cnn
rstRecordset.Open cmdCommand
rstRecordset.MoveFirs