Public Sub SubOpen()
Hi guys,
Is this the right way to populate a variable from an SQL statement in Excel? I get a type mismatch
Dim strvalue As Date
'strvalue = ""
'strvalue = getStr(6, 73, 8)
Dim strSQL As String
Dim cnn As Object
Set cnn = CreateObject("ADODB.Connection")
With cnn
.ConnectionString = "DSN=RDBWC;User ID=estgpb;PWD=B4ptist5;"
.Open
strSQL = "SELECT BUS_DAY_BFO_001_DT from PDB2I.HI_BUS_DAY_01 WHERE CAR_DAY_DT = '2012-04-01' "
Debug.Print strSQL
strvalue = .Execute(cnn, strSQL)
Debug.Print strvalue
End With
End Sub