Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 September 30th, 2004, 12:03 PM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populating a form

Hello,

I have problems using the Dlookup function in Access 2003 to populate the fields on the form when the user searchs for a record and finds it.

This is my basic form layout:
A text box called txtStoreId used for the search criteria and a button btnFindStore next to it. When the user selects this form, initially txtStoreId is empy, but on the fields I try to populate a # Name? appears.

For example in my txtStoreName field, I used this on the DataSource property of the control:
=Dlookup("[StoreName]", "tlbStore", "StoreId = '" &"[txtStoreId]" & "'")

I deleted the code for the button btnFindStore, perhaps I need to add some code here.

Any help will be greatly appreciated it!

Thanks,

Mane

P.S. I would like to attach my db but I didn't see the option.

 
Old September 30th, 2004, 03:41 PM
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

I don't know if the DLOOKUP way is the most efficent, but we'll work with it. I wouldn't put the code on the datasource property for txtStoreName. Instead, I put all the assignments on the button's ON CLICK event. Watch your spelling and watch your quotation marks.

Me.txtStoreName = DlookUp("[StoreName]", "tlbStore", "StoreId = '" & Me.txtStoreId & "'")

Are you sure it's not tblStore instead of tlbStore?


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Populating an unbound form from a table Luis Access VBA 8 November 21st, 2008 08:37 AM
Manually Populating Value in Windows Form ComboBox Ron Howerton VB.NET 2002/2003 Basics 20 February 13th, 2008 07:21 PM
Auto Populating Fields in Form E3-PSU Access VBA 3 August 29th, 2007 04:43 AM
Populating report or form textboxes Bosstone100 Access VBA 3 November 15th, 2004 03:53 PM
Populating Fields on a Form with Cookie Name-Value WebDevel Javascript How-To 1 December 5th, 2003 05:15 PM





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