Re: DLookup syntax
- From: "RipperT" <RipperT@xxxxxxxxxxx>
- Date: Wed, 14 Feb 2007 16:22:45 -0500
It returns Null, but I figured it out. It is now:
strPrinterOne = DLookup("[PrinterName]", "tblPrinters", _
"[Printer] = 'Primary'")
In the last argument, I removed the ampersands and the inner double quotes,
leaving 'Primary'. It works, but I don't know why.
Thanks for the assist.
Ripper
"Rick Brandt" <rickbrandt2@xxxxxxxxxxx> wrote in message
news:LwuAh.22036$zH1.7942@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
RipperT wrote:
I have a button that prints a report that also contains code to print
to a specific printer. The code is supposed to lookup the printer in
a table and plug it into strPrinterOne, but it's not working.
This line works:
strPrinterOne = "\\NA_COBB_TREE\IBD_DD_NDPS10.IBD.GR.G.COBB.NA"
This line doesn't:
strPrinterOne = DLookup("[PrinterName]", "tblPrinters", _
"[Printer] = '" & PrimaryPrinter & "'")
Aren't these two the same if the printer path in the String literal
is in the PrinterName column of tblPrinters where the Printer field
is Primary Printer? Nothing happens when I click this button. Help!
Rip
Open the immediate window <Ctl-G> then type...
?DLookup("[PrinterName]", "tblPrinters", _
"[Printer] = '" & PrimaryPrinter & "'") <enter>
What is returned when you press <enter>?
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
.
- References:
- DLookup syntax
- From: RipperT
- Re: DLookup syntax
- From: Rick Brandt
- DLookup syntax
- Prev by Date: Re: Data Check not checking
- Next by Date: Re: Why does this code work?
- Previous by thread: Re: DLookup syntax
- Next by thread: Re: Skip Subform when Tabbing
- Index(es):
Relevant Pages
|