Group:  Microsoft Access » microsoft.public.access.formscoding
Thread: Acess 2003

Geek News

Acess 2003
jb 11/8/2008 1:52:00 PM
Could you please see what is wrong with this formula, because it doesnt give
the right result. I think the criteria isnt well written.

DLookup("[Descrição_Artigo]";"Tipo_artigos_stock";"[Tipo_Familia_Stock]=[Familia]"
and "[Tipo_SubFamilia_Stock]=[SubFamilia]" and "[Refª_Artigo]=[refª_produto]")

thank you


Re: Acess 2003
"Ken Snell \(MVP\)" <kthsneisllis9[ at ]ncoomcastt.renaetl> 11/8/2008 3:20:34 PM
I can tell you that your syntax is wrong in the DLookup expression. The
generic syntax for multiple criteria is this:

DLookup("FieldToLookUp", "TableOrQueryName", "Field1 = AValue And Field2 =
AnotherValue")

or (if you're using controls on a form to give the values, and those values
are numeric:

DLookup(("FieldToLookUp", "TableOrQueryName", "Field1 = " &
Me.ControlNameOnForm.Value & " And Field2 = " &
Me.AnotherControlNameOfnForm.Value)

or (if you're using controls on a form to give the values, and those values
are text:

DLookup(("FieldToLookUp", "TableOrQueryName", "Field1 = '" &
Me.ControlNameOnForm.Value & "' And Field2 = '" &
Me.AnotherControlNameOfnForm.Value & "'")

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


"jb" <jb[ at ]discussions.microsoft.com> wrote in message
news:49DB92BF-D09F-465A-9DC2-8E0AF75DD4FA[ at ]microsoft.com...
[Quoted Text]
> Could you please see what is wrong with this formula, because it doesnt
> give
> the right result. I think the criteria isnt well written.
>
> DLookup("[Descrição_Artigo]";"Tipo_artigos_stock";"[Tipo_Familia_Stock]=[Familia]"
> and "[Tipo_SubFamilia_Stock]=[SubFamilia]" and
> "[Refª_Artigo]=[refª_produto]")
>
> thank you
>
>


Re: Acess 2003
Tom van Stiphout <tom7744.no.spam[ at ]cox.net> 11/8/2008 3:33:09 PM
On Sat, 8 Nov 2008 05:52:00 -0800, jb <jb[ at ]discussions.microsoft.com>
wrote:

You need commas between the arguments, not semicolons.
The third argument needs to be a single string.
Otherwise you are not providing enough information for me to
understand how to write the third argument.

-Tom.
Microsoft Access MVP


[Quoted Text]
>Could you please see what is wrong with this formula, because it doesnt give
>the right result. I think the criteria isnt well written.
>
>DLookup("[Descrição_Artigo]";"Tipo_artigos_stock";"[Tipo_Familia_Stock]=[Familia]"
>and "[Tipo_SubFamilia_Stock]=[SubFamilia]" and "[Refª_Artigo]=[refª_produto]")
>
>thank you
>
Re: Acess 2003
"Ken Snell \(MVP\)" <kthsneisllis9[ at ]ncoomcastt.renaetl> 11/8/2008 4:33:20 PM
"Tom van Stiphout" <tom7744.no.spam[ at ]cox.net> wrote in message
news:g6cbh4hfcqj45lepmhdnc2imggkddesf7a[ at ]4ax.com...
[Quoted Text]
> On Sat, 8 Nov 2008 05:52:00 -0800, jb <jb[ at ]discussions.microsoft.com>
> wrote:
>
> You need commas between the arguments, not semicolons.

Many/most non-English European versions use ; instead of , for argument
delimter.
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/



Re: Acess 2003
jb 11/10/2008 9:36:00 AM
DLookup("[Tipo_medida]";"Tipo_artigos_stock";"[Tipo_Familia_Stock]= " &
Me.[Familia].Value & " And [Tipo_SubFamilia_Stock]= " & Me.[SubFamilia].Value
& " And [Refª_artigo]= " & Me.[refª_produto].Value)

Now it tells me that a operator is missing. The values are in controls on a
form witch are numeric.

Thank you

"Ken Snell (MVP)" wrote:

[Quoted Text]
> I can tell you that your syntax is wrong in the DLookup expression. The
> generic syntax for multiple criteria is this:
>
> DLookup("FieldToLookUp", "TableOrQueryName", "Field1 = AValue And Field2 =
> AnotherValue")
>
> or (if you're using controls on a form to give the values, and those values
> are numeric:
>
> DLookup(("FieldToLookUp", "TableOrQueryName", "Field1 = " &
> Me.ControlNameOnForm.Value & " And Field2 = " &
> Me.AnotherControlNameOfnForm.Value)
>
> or (if you're using controls on a form to give the values, and those values
> are text:
>
> DLookup(("FieldToLookUp", "TableOrQueryName", "Field1 = '" &
> Me.ControlNameOnForm.Value & "' And Field2 = '" &
> Me.AnotherControlNameOfnForm.Value & "'")
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
> http://www.accessmvp.com/KDSnell/
>
>
> "jb" <jb[ at ]discussions.microsoft.com> wrote in message
> news:49DB92BF-D09F-465A-9DC2-8E0AF75DD4FA[ at ]microsoft.com...
> > Could you please see what is wrong with this formula, because it doesnt
> > give
> > the right result. I think the criteria isnt well written.
> >
> > DLookup("[Descrição_Artigo]";"Tipo_artigos_stock";"[Tipo_Familia_Stock]=[Familia]"
> > and "[Tipo_SubFamilia_Stock]=[SubFamilia]" and
> > "[Refª_Artigo]=[refª_produto]")
> >
> > thank you
> >
> >
>
>
>
Re: Acess 2003
"Ken Snell \(MVP\)" <kthsneisllis9[ at ]ncoomcastt.renaetl> 11/11/2008 3:56:58 AM
Are any of the controls' holding alphanumeric text (string text) and not
numbers? If yes, you must delimit that value with ' characters. For example,
if the Tipo_Familia_Stock control holds a string value:

DLookup("[Tipo_medida]";"Tipo_artigos_stock";"[Tipo_Familia_Stock]= '" &
Me.[Familia].Value & "' And [Tipo_SubFamilia_Stock]= " &
Me.[SubFamilia].Value
& " And [Refª_artigo]= " & Me.[refª_produto].Value)


--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


"jb" <jb[ at ]discussions.microsoft.com> wrote in message
news:F9AE8367-E441-4228-A4EA-5DB5477F487E[ at ]microsoft.com...
[Quoted Text]
> DLookup("[Tipo_medida]";"Tipo_artigos_stock";"[Tipo_Familia_Stock]= " &
> Me.[Familia].Value & " And [Tipo_SubFamilia_Stock]= " &
> Me.[SubFamilia].Value
> & " And [Refª_artigo]= " & Me.[refª_produto].Value)
>
> Now it tells me that a operator is missing. The values are in controls on
> a
> form witch are numeric.
>
> Thank you
>
> "Ken Snell (MVP)" wrote:
>
>> I can tell you that your syntax is wrong in the DLookup expression. The
>> generic syntax for multiple criteria is this:
>>
>> DLookup("FieldToLookUp", "TableOrQueryName", "Field1 = AValue And Field2
>> =
>> AnotherValue")
>>
>> or (if you're using controls on a form to give the values, and those
>> values
>> are numeric:
>>
>> DLookup(("FieldToLookUp", "TableOrQueryName", "Field1 = " &
>> Me.ControlNameOnForm.Value & " And Field2 = " &
>> Me.AnotherControlNameOfnForm.Value)
>>
>> or (if you're using controls on a form to give the values, and those
>> values
>> are text:
>>
>> DLookup(("FieldToLookUp", "TableOrQueryName", "Field1 = '" &
>> Me.ControlNameOnForm.Value & "' And Field2 = '" &
>> Me.AnotherControlNameOfnForm.Value & "'")
>>
>> --
>>
>> Ken Snell
>> <MS ACCESS MVP>
>> http://www.accessmvp.com/KDSnell/
>>
>>
>> "jb" <jb[ at ]discussions.microsoft.com> wrote in message
>> news:49DB92BF-D09F-465A-9DC2-8E0AF75DD4FA[ at ]microsoft.com...
>> > Could you please see what is wrong with this formula, because it doesnt
>> > give
>> > the right result. I think the criteria isnt well written.
>> >
>> > DLookup("[Descrição_Artigo]";"Tipo_artigos_stock";"[Tipo_Familia_Stock]=[Familia]"
>> > and "[Tipo_SubFamilia_Stock]=[SubFamilia]" and
>> > "[Refª_Artigo]=[refª_produto]")
>> >
>> > thank you
>> >
>> >
>>
>>
>>


Re: Acess 2003
John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 11/11/2008 6:00:12 PM
On Mon, 10 Nov 2008 01:36:00 -0800, jb <jb[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>DLookup("[Tipo_medida]";"Tipo_artigos_stock";"[Tipo_Familia_Stock]= " &
>Me.[Familia].Value & " And [Tipo_SubFamilia_Stock]= " & Me.[SubFamilia].Value
>& " And [Refª_artigo]= " & Me.[refª_produto].Value)
>
>Now it tells me that a operator is missing. The values are in controls on a
>form witch are numeric.

Might any of them be NULL, empty? If so you will get a criteria string like

[Tipo_Familia_Stock]= 312 And [Tipo_SubFamilia_Stock]= And [Refª_artigo]=22

which will give this error.

Note also that it is not necessary to use the .value property, since that is
the default. It doesn't hurt but it clutters your code; try just using
Me![SubFamilia] (and so on) instead.
--

John W. Vinson [MVP]

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net