Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 17th, 2006, 10:44 PM
Registered User
 
Join Date: Jun 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default DLookup Urgent

Hi all,

I'm using DLookup to get a amount.

Which table to be use, is decide by another function.
So table name is pass into a string.

Dim TableName as string
TableName = anotherfunction

Me.txt_Amt.Value = DLookup("[Entr&Sub_1yr]", "& TableName &", "[MembershipCategory] = '" & Forms![subfrm_IndiApplicationApproval]![cbo_CategoryGrant] & "'")

My error is highlight in red. Please teach me how to use.

Thanks

 
Old August 18th, 2006, 06:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Me.txt_Amt = DLookup("[Entr&Sub_1yr]", TableName, "[MembershipCategory] = '" & Forms.[subfrm_IndiApplicationApproval].Form.[cbo_CategoryGrant] & "'")



Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old August 18th, 2006, 06:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Oh, and I don't know what mischief that ampersand (&) in your field name Entr&Sub_1yr will do to your VBA code and query execution. I would remove it from any field name, e.g. Entr_Sub_1yr instead.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old August 18th, 2006, 11:29 PM
Registered User
 
Join Date: Jun 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh, thank you very much!!!
It work so well.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Dlookup JAdkins Access VBA 1 January 11th, 2008 06:52 PM
Help with DLookup Devilboy13 Access VBA 4 August 30th, 2006 02:48 PM
DLookup Teqlump Access VBA 1 August 9th, 2006 11:48 PM
How to Update DLOOKUP? cesather Access 1 December 14th, 2005 05:39 PM
DLookup - URGENT dearnne Access 2 September 5th, 2004 08:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.