Query not giving return

D

Dennis

I am trying to capture all of the medication times in one
field and I am able to capture all of the "AM", "PM",
and "HS" times but I am not able to capture the BID or TID
which should report as "AM, PM" and "AM, PM, HS". To
capture each of these records in their respective fields I
am using a module and passing the values thru it. The
following is the module:

'This module groups the SIGCODE field critera and reports
all Dot medication times in one record
Function GetSCode(strCDC_NBR As String, strSig As String)

Dim strCriteria As String

strCriteria = "[CDC_NBR] = " & Chr(34) & strCDC_NBR & Chr
(34) & _
" And Right(SIGCODE,3) = " & Chr(34) & strSig & Chr(34)

GetSCode = Right(DLookup("SIGCODE", "PillLine1qry",
strCriteria), 2)

End Function

And I use the above module in the following expressions:

AM: GetSCode([CDC_NBR],"AM")
PM: GetSCode([CDC_NBR],"PM")
HS: GetSCode([CDC_NBR],"HS")

All three of the above work, the following two do not:

AMPM: GetSCode([CDC_NBR],"AM, PM")
AMPMHS: GetSCode([CDC_NBR],"AM, PM, HS")

I have experimented with the module but have had no sucess.

I do get the returns in SIGCODE field that the above
expressions are looking for, but the last two do not
report in the expression fields?

What do you think?

Thanks,

Dennis
 
S

Steve Schapel

Dennis,

I am not sure I completely follow what you are trying to do here. But
it looks like your GetSCode function returns 2 characters (i.e. the
right-most 2 characters in the SIGCODE field). So I guess it will work
where you are desling with 2 characters, such as AM or PM, but not where
the code you are looking for is more than two characters.
 
T

Tom Ellison

Dear Dennis:

You apparently have a custom module GetSCode that isn't doing what you
want it to do. Perhaps you should talk to the person who wrote it.
I'm not sure why you sould expect it to allow you to pass it
parameters that are a list of things to do. It appears it does what
you want when you pass a single parameter like AM, PM or HS. I'm
guessing it wasn't designed to do what you want.

Since this function is custom software, no one here is likely to know
what's up with it. You didn't post the code you have for this
function, so we're all in the dark.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 

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

Top