D
Dan M
In redesigning an Access 97 database into an XP project
(SQL Server 2K back end), I'm having difficulty with
textboxes that use DLookup. And it is incredible the lack
of help available from Microsoft Access Help, the KB and
MSDN Support. Custom textbox controlsources just aren't
the same between a database and a project, but they put so
little effort into alerting us and spelling out the
differences.
If I don't specify criteria, it works, pulling the first
price of the first record:
DLookup("[ProductRetailPrice]", "tblRetailPrices")
If I hardcode my criteria, it works:
DLookup
("[ProductRetailPrice]", "tblRetailPrices", "[ProductID] =
1")
If I reference an Access object (form, textbox, etc.), it
doesn't work:
DLookup
("[ProductRetailPrice]", "tblRetailPrices", "[ProductID] =
[txtProductID]")
OR
("[ProductRetailPrice]", "tblRetailPrices", "[ProductID] =
[Form]![txtProductID]")
(Please don't tell me my syntax is wrong, objects in
Access projects have trouble referencing other objects)
If I build the controlsource string in VBA, it still
doesn't work:
lngProductID = txtProductID
txtRetailPrice.ControlSource = "DLookup
('[ProductRetailPrice]', 'tblRetailPrices', '[ProductID]
= " & lngProductID & "')"
Any insight would be greatly appreciated. And any sources
for help on differences between databases and projects,
especially related to form object properties, would be
even more appreciated.
(SQL Server 2K back end), I'm having difficulty with
textboxes that use DLookup. And it is incredible the lack
of help available from Microsoft Access Help, the KB and
MSDN Support. Custom textbox controlsources just aren't
the same between a database and a project, but they put so
little effort into alerting us and spelling out the
differences.
If I don't specify criteria, it works, pulling the first
price of the first record:
DLookup("[ProductRetailPrice]", "tblRetailPrices")
If I hardcode my criteria, it works:
DLookup
("[ProductRetailPrice]", "tblRetailPrices", "[ProductID] =
1")
If I reference an Access object (form, textbox, etc.), it
doesn't work:
DLookup
("[ProductRetailPrice]", "tblRetailPrices", "[ProductID] =
[txtProductID]")
OR
("[ProductRetailPrice]", "tblRetailPrices", "[ProductID] =
[Form]![txtProductID]")
(Please don't tell me my syntax is wrong, objects in
Access projects have trouble referencing other objects)
If I build the controlsource string in VBA, it still
doesn't work:
lngProductID = txtProductID
txtRetailPrice.ControlSource = "DLookup
('[ProductRetailPrice]', 'tblRetailPrices', '[ProductID]
= " & lngProductID & "')"
Any insight would be greatly appreciated. And any sources
for help on differences between databases and projects,
especially related to form object properties, would be
even more appreciated.