Help with a variable (1 Viewer)

robert693

Registered User.
Local time
Today, 22:47
Joined
Mar 22, 2001
Messages
38
I converted a database from 97 to 2000 and I haven't been able to get a variable from the 97 database to work in 2000. It is: Dim Tb1 as Table. I have tried Dim Tb1 as DAO.Table and Dim Tb1 as ADOX.Table but nothing I have tried works. The module concatenates names and addresses from a table and places the concatenated address in a field. The module goes like this:
Function Mashit()
Dim CRLF As Variant, TheDB As Database, Tb1 As Table
Dim N1 As String, N2 As String, N3 As String
Set TheDB = CurrentDb()
Set Tb1 = TheDB.OpenTable("LEADS")
Tb1.Index = "Last Name"
Tb1.MoveFirst
CRLF = Chr(13) & Chr(10)
Do Until Tb1.EOF
If IsNull(Tb1("Mashed")) Then
If Not IsNull(Tb1("First Name")) Then
If Not IsNull(Tb1("Company")) Then
If Not IsNull(Tb1("Address 2")) Then
N1 = Tb1("First Name") & " " & Tb1("Middle Initial") & " " & Tb1("Last Name")
N2 = Tb1("Company") & CRLF & Tb1("Address 1")
N3 = Tb1("Address 2") & CRLF & Tb1("City") & ", " & Tb1("State") & " " & Tb1("Zip") & " " & Tb1("Country")
Tb1.Edit
Tb1("Mashed") = N1 & CRLF & N2 & CRLF & N3
Tb1.Update
Else
N1 = Tb1("First Name") & " " & Tb1("Middle Initial") & " " & Tb1("Last Name")
N2 = Tb1("Company") & CRLF & Tb1("Address 1")
N3 = Tb1("City") & ", " & Tb1("State") & " " & Tb1("Zip") & " " & Tb1("Country")
Tb1.Edit
Tb1("Mashed") = N1 & CRLF & N2 & CRLF & N3
Tb1.Update
End If
Else
If Not IsNull(Tb1("Address 2")) Then
N1 = Tb1("First Name") & " " & Tb1("Middle Initial") & " " & Tb1("Last Name")
N2 = Tb1("Address 1") & CRLF & Tb1("Address 2")
N3 = Tb1("City") & ", " & Tb1("State") & " " & Tb1("Zip") & " " & Tb1("Country")
Tb1.Edit
Tb1("Mashed") = N1 & CRLF & N2 & CRLF & N3
Tb1.Update
Else
N1 = Tb1("First Name") & " " & Tb1("Middle Initial") & " " & Tb1("Last Name")
N2 = Tb1("Address 1")
N3 = Tb1("City") & ", " & Tb1("State") & " " & Tb1("Zip") & " " & Tb1("Country")
Tb1.Edit
Tb1("Mashed") = N1 & CRLF & N2 & CRLF & N3
Tb1.Update
End If
End If

End If
End If
Tb1.MoveNext
Loop
Tb1.Close

End Function

I am sorry that pasting this in here makes it hard to read! I hope somebody can help make this work! Thank you very much!
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:47
Joined
Feb 28, 2001
Messages
27,192
Probably should be ADO.Table, not ADOX.Table.

But just to make sure, check your references to make sure you are referencing the right libraries. I had a somewhat related problem moving one of my DB's from 97 to 2K. It turned out that the DAO library version had changed. The reference in the DB was for the wrong file. So what I had to do was get into a code editing screen in a module and click Tools>>References.

I scanned the resulting list until I found a MISSING reference. The expected file name is shown in that dialog box, so I made a note. I unchecked the box. Then I browsed for files with names similar to the library reference.

In my particular case, what had happened was that my DAO35.??? had become DAO36 under AC2K. (Don't remember offhand if it was the .DLL or something else, but the name will be there in the dialog box.) So I double-clicked the DAO36.whatever in the References dialog box. That checked it and made the references available. That also solved my DAO.Table problem.
 

Users who are viewing this thread

Top Bottom