Re: Functions with Dlookup?



That should work. You sure iMonth is the correct value? Is VanID a text
field? (If so, you need quotes around the value).

BTW, Date is a bad choice for a field name: it's a reserved word, and using
reserved words for your own purposes can leads to lots of problems.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"scadav" <anonymous@xxxxxxxxx> wrote in message
news:W6OdnU07ftIgk_XYnZ2dnUVZ_uidnZ2d@xxxxxxxxxxxxxx
Can you use a function within Dlookup? If so, how....

I am trying to extract information from a table, but I want to do it for a
particular month. So I was trying to do the following, but wasn't having
much luck trying to retrieve the month number from a date field. Any help
would be appreciated:

In this example, Date is a Field in the database with the datatype of
Date/Time

sTest = DLookup("[MilesRecordedID]", "VanMiles", "Month([Date]) = " &
iMonth & " AND [VanID] = " & rsVans!VanID)


.



Relevant Pages

  • Re: Functions with Dlookup?
    ... you need quotes around the value). ... BTW, Date is a bad choice for a field name: it's a reserved word, and ... changing the field Date to EntryDate. ...
    (microsoft.public.access.gettingstarted)
  • Re: Dlookup and update not working correctly
    ... resources you would recommend for figuring out this kind of syntax? ... You need to put the variable outside the quotes. ... reserved word and will be confused with the VBA function. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Making use of a Passed Argument
    ... you are passing it the literal string "ServiceN". ... quotes, it will pass the value of the variable. ... You shouldn't name any of your fields or any other object with a reserved word. ...
    (microsoft.public.access.formscoding)
  • Re: Date format to display month name
    ... just put full quotes around the ... (a Reserved word) ... except in your labels and captions ...
    (microsoft.public.access.queries)
  • Re: Is "From" a legal col name.
    ... This is not really a java question, but java is my platform so I'm ... Is "From" a legal column name? ... if you use a reserved word as an identifier you have to quote it with double quotes: ... Note that most DBMS are case-sensitiv when using double quotes, so maybe in your case it should read: ...
    (comp.lang.java.databases)