Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with a variable

Status
Not open for further replies.

robert693

Programmer
Jun 20, 2001
40
US
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 hope somebody can help make this work! Thank you very much!

 
What is the error that you are getting? Have fun! :eek:)

Alex Middleton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top