RE: DBLookup problem in a query

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi.

If FiscalMonth is not a numerical data type, then the value assigned to it
must be delineated as a string. This can be single quotes or a pair of
double quotes. For example (all one line):

Month: DLookUp("[Month]","Months","[FiscalMonth]= '" &
Forms!frmPNInputTime![Fiscal Month]) & "'"

Ensure that the frmPNInputTime form is open when this query is run and that
it has a value. Also, Month is a reserved word, so I would suggest using a
different name for the field and alias, so as to prevent unexpected results
in expressions (i.e., bugs).

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are Ripley@xxxxxxxxxxxxxxx and scott@xxxxxxxxxxxxxxxxxx

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. Remember that the first and
best answers are often given to those who have a history of rewarding the
contributors who have taken the time to answer questions correctly.


"MacNut" wrote:

> Hello,
>
> I have a problem with a dblookup in my query. Here is the code I have:
>
> Month: DLookUp("[Month]","Months","[FiscalMonth]=" &
> Forms!frmPNInputTime![Fiscal Month])
>
> Now, it works for the initial part of the code when not using the criteria
> portion of the code. What is going wrong?
>
> Thank you,
> MN
.



Relevant Pages

  • RE: Proper Query Type
    ... I forgot to fix some of the syntax besides the single quotes in my ... Gunny ... Community, please sign in to the Community and mark these posts, so that all ... >> I want to make sure that I am using the right query type. ...
    (microsoft.public.access.queries)
  • RE: DBLookup problem in a query
    ... The January you see in the query may be ... > May is in the Month field, 5 is in the FiscalMonth field. ... > Beware to those who use munged addresses: known newsgroup E-mail harvesters ... > Community, please sign in to the Community and mark these posts as "Answers," ...
    (microsoft.public.access.modulesdaovba)
  • Re: parameter query not prompting for parameter
    ... The single quotes were actually put in there by Access when I entered the ... try to save the query, ... > parameter literally as a string". ... us a control on a form as a criteria in your query. ...
    (microsoft.public.access.queries)
  • Re: Using Wildcards
    ... SQL server is converting my query to single quotes, ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Excel VBA Passing Parameters Through Cell
    ... when opening the query through Microsoft Query (selecting ... .PreserveFormatting = True ... .RefreshStyle = xlOverwriteCells ... I am not able to put single quotes around the dates directly in the ...
    (microsoft.public.excel.programming)