Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 3rd, 2012, 09:11 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default dlookup help please

I have a combobox for the "customers" last name, when selected it autofills the rest of the information about the customer into other fields on the same form. My issue is the database was set up on a fly and the primary key is "order number" so the customers name is listed multiple times. When the user selects the combobox there are hundreds of smiths. Do I have to make a new form with a subform so it's done right or can I just add a new field to somehow limit the customer information to one record? The thought of having to redo the relationships throughout the entire database is killing me.

I used
Me.First = DLookUp("[First]", "Request_Information", "[Last] = '" & Me.Last & "'")

Thanks,
Steffani
Reply With Quote
  #2 (permalink)  
Old February 4th, 2012, 12:55 PM
Friend of Wrox
Points: 1,015, Level: 12
Points: 1,015, Level: 12 Points: 1,015, Level: 12 Points: 1,015, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2010
Posts: 245
Thanks: 5
Thanked 24 Times in 23 Posts
Default

Steffani,


Quote:
Originally Posted by STEFFANI View Post
Do I have to make a new form with a subform so it's done right or can I just add a new field to somehow limit the customer information to one record?
I don't follow that.

The correct way is to have a separate customer table. The user would select the customer from the customer table with the combo box. This would make what you need to do very easy.

While your current method may work, I am worried about how reliable it will be. I would avoid the Dlookup() for what you need.




Quote:
Originally Posted by STEFFANI View Post
The thought of having to redo the relationships throughout the entire database is killing me.
It should not be that difficult to fix the database's table structure to be correct.

I have fixed many databases that have poor table design. I have also tries to work with database that have a poor table design.


If you keep a poor table design then simple things become difficult and time consuming. The database also becomes very fragile and easy to mess up the data. In the long run you spend a lot ore time maintaining a database with a a poor table design.


It may seam like a lot of work to correct the tables and update all the objects. The advantage is that once it is done then everything gets a lot easier. Sure it requires a lot of work up front. The benefits are definitely worth it. It also allows you to make your database a lot more user friendly. This generally helps the users be a lot more productive.


This may help: Database Normalization Resources
__________________
Boyd Trimmell aka HiTechCoach (.com)
Microsoft Access MVP Alumni 2010-2015
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DLookup Help jchristadore Access 3 February 20th, 2009 08:55 AM
Dlookup problems jik VB How-To 0 February 15th, 2007 04:27 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
Dlookup with If ..Then ..Else and Chkboxes ecampos Access VBA 1 August 19th, 2005 01:51 PM



All times are GMT -4. The time now is 11:53 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.