one text from several records

SunWuKung

Registered User.
Local time
Today, 13:18
Joined
Jun 21, 2001
Messages
172
I have records in the format of:
AAAAAAAAAAA 3
BBBBBBBBBBB -4
CCCCCCCCCCC 5

I would like to display them as:
3*AAAAAAAAAAA-4*BBBBBBBBB+5*CCCCCCCCCCC

Could somebody tell me how to achieve this?
 
Could you please clarify a bit where your data comes from?

Do you have a table with 2 fields

LETTERS ------- NUMBERS
AAAAAAAAAAA ------- 3
BBBBBBBBBBB ------- -4
CCCCCCCCCCC ------- 5

or are all your records in one field?

FIELD
AAAAAAAAAAA 3
BBBBBBBBBBB -4
CCCCCCCCCCC 5


[This message has been edited by capri (edited 07-20-2001).]
 
They come from two fields - sorry it wasn't clear from the mail (it looked ok, when I typed them in).

In the meantime I struggled togather a code (taking everything from newsgroups here) that does this, (I had a parameter in the query which created further complications).

------------------------------------------------------------------------------------------
Public Function ConcRec()
Dim strOutput As String


Set QD1 = CurrentDb.QueryDefs!Model_Instrument_for_Equation
QD1.Parameters![InstrumParam] = Forms![Main]![Instrument].Value
QD1.Parameters![CompetencyParam] = Reports![Model_Instrument]![CompetencyName].Value
Set RecSource = QD1.OpenRecordset

Do While Not RecSource.EOF
If RecSource.Fields("WeightedScale").Value > 0 Then strOutput = strOutput & "+" Else strOutput = strOutput & "-"
strOutput = strOutput & RecSource.Fields("WeightedScale").Value
RecSource.MoveNext
Loop
Set RecSource = Nothing
If strOutput = "" Then strOutput = "+No equation can be generated"
ConcRec = Mid(strOutput, 2, Len(strOutput) - 1)

End Function

------------------------------------------------------------------------------------------

Thank you for your help.
Could you tell me why did I always get an error message "user defined type not defined" when I add the following line? Everybody seems to use it in their code, I know this must be Lesson1 topic, but what am I doing wrong?

Dim db as Database

Thanks for the help again.

SWK

[This message has been edited by SunWuKung (edited 07-23-2001).]
 

Users who are viewing this thread

Back
Top Bottom