Query results in messagebox

  • Thread starter Thread starter Wendy
  • Start date Start date
W

Wendy

Hi

Is is possible to display the results of a query in a messagebox. I wanted
to do this to give the users the chance to abort the rest of the macro if
the results were not correct.

Thanks

Wendy
 
Using VBa sure.. direct from Query no..

--
Saludos desde Oviedo (Asturias)

Juan Menéndez
Mastercafe S.L.
www.mastercafe.com
(e-mail address removed)

Si la información recibido te ha servido indicalo con otro post.
En caso de resolverlo por otros medios, indica la solución usada
ayudaras a otros y aprenderemos todos.
 
Wendy,

Well, yes possibly - it depends what you mean, really. I've just been
working tonight with a query that returns 150,000 rows, about 30 fields,
and I wouldn't like to try and put that into a message box! Can you
please give some more details, with examples, of what you want to do?
 
Yes its a bank statement, that we download daily direct from the bank,
sometimes we don't end up with the correct days transactions and want to see
the date and values before allowing the macro to continue. The macro add
our id codes to the data, exports it to the mainframe as fixed text file and
the mainframe attaches the transactions to the database.
I only need to display the first line from each file, unfortunately we don't
know how many files the bank is going to send each day, so we have to do
each one individually. I can do it in a query but I wanted to do it in a
messagebox displayed whilst the macro was running giving the option to kill
the macro if the data was incorrect.
This is the code from the query.
SELECT TOP 1 NLMBANK1.TRANSDATE, NLMBANK1.AMOUNT, NLMBANK1.DETAILS,
NLMBANK1.TRANSCODE, NLMBANK1.CHEQUENO
FROM NLMBANK1
WHERE (((NLMBANK1.TRANSCODE) Not Like "CC" And (NLMBANK1.TRANSCODE) Not Like
"MSC" And (NLMBANK1.TRANSCODE) Not Like "CHG"));

Wendy
 
Wendy,

You can do this in a Condition in your macro.

Your query at the moment has an unusual use of the Like operator, which
is normally used in the case of where a wildcard in involved in your
criteria. From your explanation, I gather you would really only need to
see the date. So, the Condition like this...

MsgBox("Process transactions for " &
DLookup("[TRANSDATE]","NLMBANK1","[TRANSCODE] Not In('CC','MSC','CHG')")
& "?",36)=6
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top