Hi Harry, sorry it took me a while to answer
The DLookUp consist of three parts
=DLookUp("Retrieve the value from this field","From this table","using this
filter")
the filter can be fixed like:
=DlookUp("Field1Name","TableName","Field2Name = 'aaa'")
so the dlookup will return the value of field1name where field2 in the table
equal "aaa"
===========================================
the filter can use parameters that are used to filter a field in the table
To filter string field (StringFieldName is a name of the field you want to
filter in the table)
=DlookUp("Field1Name","TableName","StringFieldName = '" & Parameter & "'")
To filter numeric field
=DlookUp("Field1Name","TableName","NumericFieldName = " & Parameter)
To filter date field
=DlookUp("Field1Name","TableName","DateFieldName = #" & Parameter & "#")
=========================================
You can filter two fields together or even more, by adding "Filter And
AnotherFilter"
=DlookUp("Field1Name","TableName","StringFieldName = '" & Parameter & "' And
NumericFieldName = " & Parameter2)
======================
I hope it's clear, if you need more help, I'll need this details
1. Table Name
2. Fields name in the table and there type (the value you need and which
fields are needed for the filter)
3. The parameters name and to which field in the table they refer to
--
Good Luck
BS"D
Harry F. said:
Ofer,
Thanks, this is a great start. Can you please explain what
"[NumberFieldNameInTable] = " &
[NumberFieldNameInForm] & " And [StringFieldNameInTable] = '" &
[StringFieldNameInForm] relate to?
The fields I am using are:
Parameter 1: ClassCode
Parameter 2: BusinessCode
Desired Result: CounterpartyType
Thanks again!
Harry
:
Using DlookUp in the TextBox control source
=DlookUp("[FieldName]","[TableName]","[NumberFieldNameInTable] = " &
[NumberFieldNameInForm] & " And [StringFieldNameInTable] = '" &
[StringFieldNameInForm] & "'")
Note: The strig field name has single quote before and after the value, the
number has none.
If you filter by DateField then you need to add # before and after
--
Good Luck
BS"D
:
Hi,
I need to create a form where a user supplies two parameters, and based on
those parameters, the form should run them against a table and provide a
value. How do I do this????