How to use Iif and EOF

kupe

Registered User.
Local time
Today, 09:01
Joined
Jan 16, 2003
Messages
462
Can I use an immediate if function when referring to the EOF.

I want to say Iif(myfield, EOF = " ", " | ") ... but I would like to code it the right way. Grateful for advice, Experts.
 
EOF is a Boolean ReadOnly Property of a RecordSet. IIf returns a value so the proper use would be SomeObject = IIf(.... Why not explain *what* you are trying to accomplish rather than *how* you are trying to do it? I'm sure someone here would be able to assist and comment.
 
Hi RuralGuy

I'd like the vertical "|" to follow each chosen record from a field, except the last one.

Like this - Bob | Mary | Rural Guy | Ben

I'd like to do it in sql, and I thought that the immediate if function might be the answer. Sorry, I was wrong. Be pleased if you know the correct way. Cheers.
 
Easiest way would probably be to find all your chosen records using an sql select, dump them into a recordset, then do something like the following

Code:
Do while not rs.EOF
   strResult = rs.Field(1) & "|"
   rs.MoveNext
Loop
strResult = Right(strResult, 1)
 
I'd like the vertical "|" to follow each chosen record from a field, except the last one.

Like this - Bob | Mary | Rural Guy | Ben
Follow it where? Are you exporting to a file or program, sending it to a report or a form? We're still lacking some information as to *what* you are attempting. Give us the BIG picture view.
 
heh :) rural guy, I just kinda made the assumption in my reply that if its in a string like that, then kupe can export and use it whereever they need to.
 
Hi WorkMad, I can see that and it might be right on the money. I just thought the OP needs to supply additional information so we don't point him/her in the wrong direction. By the way correct me if I'm wrong but I think you needed to use the Fields collection to reference in that manner.

strResult = rs.Fields(1) & "|"
 
Thanks very much, workmad3, cheers RG. Looks good. Much obliged to you.
 

Users who are viewing this thread

Back
Top Bottom