lookup

pradyuthal

Board Regular
Joined
Jul 13, 2005
Messages
212
<CENTER><TABLE cellSpacing=0 align=center cellpadding=2px width=50% ><TR ><TD CLASS="AccTBMain" border-left=1px solid colSpan= 3 ><TABLE width="100%" align=left VALIGN="TOP" ><TR ><TD CLASS="AccTBInner" align=Left ><font color="White">testcategory : Table</font></TD><TD CLASS="AccTBInner" align=right >Access 2000</TD></TR></TABLE></TD></TR><TR ><TD CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccHDRMain" align=left >categoryid</TD><TD CLASS="AccHDRMain" align=left >categoryname</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >1</TD><TD CLASS="AccDataElem" >nonta</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >2</TD><TD CLASS="AccDataElem" >sweet</TD></TR><TR ><TD ID="IE" CLASS="AccIEOnlyMain" colSpan= 3 ><TABLE width="100%" align=left VALIGN="TOP" ><TR ><TD CLASS="AccIEOnlyInnerRight" > Record: </TD><TD CLASS="AccButton" >
</TD><TD CLASS="AccIEOnlyData" > 1 </TD><TD CLASS="AccButton" >
</TD><TD CLASS="AccIEOnlyInnerLeft" > of 2</TD></TR></TABLE></TD></TR><TR ><TD CLASS="AccIEOnlyMain" colSpan= 3 ><TABLE cellSpacing=0 cellPadding=0 width="100%" align=left VALIGN="TOP" ><TR ><TD ID="Data82496107" CLASS="AccInfoBarInnerRight" >testcategory</TD><TD ID="Info82496107" CLASS="AccInfoBarData" > Record Count: 2</TD></TR></TABLE></TD></TR><TR ><TD CLASS="tpkrow" colSpan = 3 ><CENTER><font size = 1>Access HTML Add-in provided by theprimarykey.com</font></CENTER></TD></TR></TABLE></CENTER>


<CENTER><TABLE cellSpacing=0 align=center cellpadding=2px width=50% ><TR ><TD CLASS="AccTBMain" border-left=1px solid colSpan= 4 ><TABLE width="100%" align=left VALIGN="TOP" ><TR ><TD CLASS="AccTBInner" align=Left ><font color="White">testproduct : Table</font></TD><TD CLASS="AccTBInner" align=right >Access 2000</TD></TR></TABLE></TD></TR><TR ><TD CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccHDRMain" align=left >productid</TD><TD CLASS="AccHDRMain" align=left >productname</TD><TD CLASS="AccHDRMain" align=left >categoryname</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >1</TD><TD CLASS="AccDataElem" >nonta1</TD><TD CLASS="AccDataElem" >nonta</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >2</TD><TD CLASS="AccDataElem" >nonta2</TD><TD CLASS="AccDataElem" >nonta</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >3</TD><TD CLASS="AccDataElem" >sweet1</TD><TD CLASS="AccDataElem" >sweet</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >4</TD><TD CLASS="AccDataElem" >sweet2</TD><TD CLASS="AccDataElem" >sweet</TD></TR><TR ><TD ID="IE" CLASS="AccIEOnlyMain" colSpan= 4 ><TABLE width="100%" align=left VALIGN="TOP" ><TR ><TD CLASS="AccIEOnlyInnerRight" > Record: </TD><TD CLASS="AccButton" >
</TD><TD CLASS="AccIEOnlyData" > 1 </TD><TD CLASS="AccButton" >
</TD><TD CLASS="AccIEOnlyInnerLeft" > of 4</TD></TR></TABLE></TD></TR><TR ><TD CLASS="AccIEOnlyMain" colSpan= 4 ><TABLE cellSpacing=0 cellPadding=0 width="100%" align=left VALIGN="TOP" ><TR ><TD ID="Data641072571" CLASS="AccInfoBarInnerRight" >testproduct</TD><TD ID="Info641072571" CLASS="AccInfoBarData" > Record Count: 4</TD></TR></TABLE></TD></TR><TR ><TD CLASS="tpkrow" colSpan = 4 ><CENTER><font size = 1>Access HTML Add-in provided by theprimarykey.com</font></CENTER></TD></TR></TABLE></CENTER>



<CENTER><TABLE cellSpacing=0 align=center cellpadding=2px width=50% ><TR ><TD CLASS="AccTBMain" border-left=1px solid colSpan= 4 ><TABLE width="100%" align=left VALIGN="TOP" ><TR ><TD CLASS="AccTBInner" align=Left ><font color="White">testsale : Table</font></TD><TD CLASS="AccTBInner" align=right >Access 2000</TD></TR></TABLE></TD></TR><TR ><TD CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccHDRMain" align=left >saleid</TD><TD CLASS="AccHDRMain" align=left >productname</TD><TD CLASS="AccHDRMain" align=left >categoryname</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >1</TD><TD CLASS="AccDataElem" >nonta1</TD><TD CLASS="AccDataElem" >
</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >2</TD><TD CLASS="AccDataElem" >nonta2</TD><TD CLASS="AccDataElem" >
</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >3</TD><TD CLASS="AccDataElem" >sweet1</TD><TD CLASS="AccDataElem" >
</TD></TR><TR ><TD ID="IE" CLASS="AccIEOnlyMain" colSpan= 4 ><TABLE width="100%" align=left VALIGN="TOP" ><TR ><TD CLASS="AccIEOnlyInnerRight" > Record: </TD><TD CLASS="AccButton" >
</TD><TD CLASS="AccIEOnlyData" > 1 </TD><TD CLASS="AccButton" >
</TD><TD CLASS="AccIEOnlyInnerLeft" > of 3</TD></TR></TABLE></TD></TR><TR ><TD CLASS="AccIEOnlyMain" colSpan= 4 ><TABLE cellSpacing=0 cellPadding=0 width="100%" align=left VALIGN="TOP" ><TR ><TD ID="Data857174158" CLASS="AccInfoBarInnerRight" >testsale</TD><TD ID="Info857174158" CLASS="AccInfoBarData" > Record Count: 3</TD></TR></TABLE></TD></TR><TR ><TD CLASS="tpkrow" colSpan = 4 ><CENTER><font size = 1>Access HTML Add-in provided by theprimarykey.com</font></CENTER></TD></TR></TABLE></CENTER>

on testsale form whenever I select a particular product , namely nonta1 from the combo box then the categoryid field will automatically be populated with the categoryid namely nonta not the categoryid number.
I paste this in the default value of test sale form’s categoryid field and simultaneously in the same field. An error message #name? appears in the category id field.

=DLookUp("[testproduct]![categoryname]","[testproduct]","[testproduct]![productname] = " & [testproduct]!productname)

Please help me.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
if this is the default value for categoryID, a number field, then your dlookup needs to evaluate to a number... [testproduct]![categoryname] is text.

Additionally, when you are comparing strings you need to remember to wrap the text to be evaluated in quotes, like this: "[testproduct]![productname] = '" & [testproduct]!productname & "'"

hth,
Giacomo
 
Upvote 0

Forum statistics

Threads
1,214,981
Messages
6,122,565
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top