[mso] Re: Access Question

  • From: Thomas Hutchins <hutch99999@xxxxxxxxx>
  • To: mso@xxxxxxxxxxxxx
  • Date: Mon, 1 May 2006 11:47:34 -0700 (PDT)

Christine,
   
  I agree with Andrew that your employee listing table has redundant data. It 
should not have both the office number and office name; that's a bad relational 
design. If it has the office number, you can join to the office table and get 
the office name whenever you need it.
   
  That said, let me try to help with your requests.
   
  I'm assuming that the RecordSource for your form is the employee listing 
table. 
   
  On your new employee form, create a combobox for the office number field. Set 
its ControlSource to the office number field. Set its RowSource property to an 
SQL query similar to the following:
   
  SELECT [Offices].OfficeNbr FROM [Offices] GROUP BY [Offices].OfficeNbr ORDER 
BY [Offices].OfficeNbr; 
   
  This way, the combobox contains all the office numbers, but as you scroll 
through the employees, the office number assigned to that employee in the 
employee listing table will be selected (you can change it using the combobox, 
also).
   
  If you want to keep office name in the employee listing table, or just show 
it on the form, put a textbox (Locked = True, TabStop = False, etc.) on the 
form to represent the field. Give its ControlSource property a Dlookup 
statement like the following:
   
  =DLookUp("[OfficeName]","Offices","[OfficeNbr] = " & "'" & 
Forms!Form1!cboOfficeNbr & "'")
   
  The office name for the selected office number will always be displayed in 
the textbox. Please note "'" is double quote single quote double quote (took me 
forever to figure out that's how to treat text parameters). If your office 
numbers are truly numeric, you don't need them, and the Dlookup would be more 
like this:
   
  =DLookUp("[OfficeName]","Offices","[OfficeNbr] = " & Forms!Form1!cboOfficeNbr)
   
  Hope this is helpful,
  
Hutch

"McDonald, Christine, Ms, DCAA" <Christine.McDonald@xxxxxxxx> wrote:
  Ok. I'm not even sure how to word this question, but here goes:

I have a database with 3 tables. Table one is the employee listing
table. It has fields that include the employee name, office number,
office name and specialty.

Table 2 is a table of all the office numbers and corresponding names.

I'm trying to develop a form to use to update the employee listing table
with new employees. I want to be able to do two things:

One - allow the user to select from a drop down list of office numbers,
the correct office number.
Two - have the form automatically pick up the office name based on the
office number.

Use this information to insert a new record with the new employee.

I've looked through several books and done some web searches on how to
do this, the problem is I'm not really sure how to search for what I
want to do, so it's making it difficult to find. Can anyone point me in
the right direction?

Thanks,

Christine McDonald, CPA
Technical Specialist
Information Technology Division (RSA-4)
Western Regional Office



*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu. This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions. Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************


                
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min 
with Yahoo! Messenger with Voice.

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the dropdown 
menu at the top.  This will allow you to unsubscribe your email address or 
change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles

If you are using Outlook and you see a lot of unnecessary code in your email 
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************

Other related posts: