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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Turn a One Column Table into a string?

Status
Not open for further replies.

CptCrusty1

Programmer
Feb 17, 2005
216
US
I have a Table that I need to have turned into a string.

The table is called tblDestinationLoc:

The column is called:
Location_Num (Text 4)
The output needs to look like:

'0001','0002','0003' and so on. There can be 1 record, or 500 records. The number of records is defined by the user.

I think I'm going to have to use DAO commands, but if there is an easy way.........

Thanks.
Rich.

 
Code:
With Currentdb.OpenRecordset("tblDestinationLoc")
     Do Until .EOF
          strText = "'" & .Fields("Locaton_Num") & "', "
          .MoveNext
     Loop
End With
Hope this helps!

-------------------------
Just call me Captain Awesome.
 
I'm getting an error saying Item not found in this location for the line:

strText = "'" & .Fields("Locaton_Num") & "', " When I hover over the .Fields portion, it says:

.Fields("Location_Num")=<Item not found in this collection.>

I'm doing this from within a module.

THanks
Richard.
 
What is the name of the field with the data in it? I thought it was Location_Num, but if not you should change it to the correct field name.

-------------------------
Just call me Captain Awesome.
 
The field with the data in it is Location_Num which is a text field. I think its having a problem with the .Field Method. Is their a reference I need to select? (Tools>references) from VB?

RK
 
I see the problem. We both typed location wrong:
Locaton
Location

Hopefully that'll do it.

-------------------------
Just call me Captain Awesome.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top