In Word 2010 (with an Access 97 backend), the following code works just fine:
Code: Select all
Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase(GetDataPath)
Set rs = db.OpenRecordset("SELECT ADDRESS.* FROM MAIL_ADDRESS WHERE ((ID)=" & txtID.Text & ");")
If rs.RecordCount > 0 Then
If Len(Trim(rs![NAME])) > 0 Then strAddress = rs![NAME]
If Len(Trim(rs![MADDR])) > 0 Then strAddress = strAddress & vbCrLf & Trim(rs![MADDR])
If Len(Trim(rs![MCITY])) > 0 Then strBankAddress = strAddress & vbCrLf & Trim(rs![MCITY])
If Len(Trim(rs![MSTPOST])) > 0 Then strBankAddress = strAddress & ", " & Trim(rs![MSTPOST])
If Len(Trim(rs![MZIP5])) > 0 Then strBankAddress = strAddress & " " & Trim(rs![MZIP5])
Selection.TypeText strAddress
End If
Code: Select all
Dim db As Database
Dim rst As Recordset
Set db = OpenDatabase(GetDataPath)
Set rst = db.OpenRecordset("Select Agency from tblAgencyAddresses Group By Agency;")
rst.MoveLast
rst.MoveFirst
Do While Not rst.EOF
lstAgencies.AddItem rst!Agency
rst.MoveNext
Loop
According to MS, error 3170 has something to do with drivers not being installed properly. I highly doubt I'll be able to convince them to reinstall drivers for everyone, so I'm trying to work around this.
So, my question is, why would one work and one not work, and what can I do to make it work for both, all the time?