AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scottgem
Expertise
I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience
I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > Database Relationships

Using MS Access - Database Relationships


Expert: Scottgem - 2/2/2005

Question
Hi Scott me again.

Thanks mate, that's working a treat :)

Now, I don't know if you remember, but I did mention that I had a couple of things I wanted to ask you. Here's the rest...........


1.   I'm using a Switchboard to open my Form to view the data and when the form opens I automatically want the Find /Replace dialog box to open. Is this possible and if it is what do I need to do to get this to work?

2.   I don't want users to be able to edit the data in the Form view as this will leave the data open to errors etc. So, how do I stop users from being able to do edit data in the form view, but without effecting user being able to enter/update data in the Tables datasheet view?

Once again, thanks for your time with me on this, much appreciated.


Gary the grateful :)







-------------------------



Followup To
Question -
Hi Scott, I don't wanna take up too much of your time, but...........

When I created my Form with SubForm from my Tables I didn't get asked to set a linking field, so, how or where do I got to create this linking field?

Thanks again, your time is much appreciated :)

Gary




-------------------------
Followup To
Question -
-------------------------
Followup To Scott,

Question - OK. To be honest I thought I already done that, so, to make sure I have got it correct. Please tell me how to create the Foreign key and how do I set the linking fields to SupplierID?

Thanks,

Gary


Hi Scott,

I got a couple of questions for you. I hope that¡¦s ok..................

Firstly, a bit of background. I¡¦ve got two tables where I want to pull all of the information from both tables together in one Form. The Form was created using the Wizard. I selected all of the fields from both Tables and created it as a Form with Sub-forms. I created a primary key in my Main Table and for the Foreign key in my secondary table (I did this by created a lookup column to the Primary key). I¡¦ve also set up all of the relationships.

The problem is this. When I Open up my Form to add or view data, the Sub Form shows all data entered and not the data related to the Main Form. So when I¡¦m scrolling thru or do a find I want the Sub-Form data to be the associated data with the main Form.
An alternative explanation is this. I have 5 supplier and they all supply me with different items. My first Table and the main window of my Form are the supplier address and contact details. The Sub-Form is the items details. When I scroll through the suppliers details in the main window the Sub-Form should scroll as well, showing each suppliers own item list, but currently it just stays showing the same data no matter what supplier I scroll to.

Can you explain how I get both Form details and Sub-Form details to scroll thru together so all the information in the view is relating to the same supplier?

After all that I¡¦ll leave the second question for now ƒº

Thanks in advance for any help you can give and I hope I¡¦ve been descriptive enough.

PC Details:
Pentium 4 2.5ghz
2 gig ram
WinXP
Office XP

Thanks and regards,

Gary



Answer -
You have two tables: (i.e. tblSuppliers and tblItems). The primary key for tblSuppliers is SupplierID. You then have a Foreign key in tblItems; SupplierID. From there, when you insert the subform, you should set the linking fields to SupplierID. That should only display matching Items in the subform.

HTH
Scott<>
Answer -
You should have a field in tblItems named SupplierID and set to Number, Long Integer. Generally you use a combobox to select the correct supplier and store their ID in that field. When you use the wizard to create a subform, it will prompt you to create the links. You can do it manaully, by looking at the properties of the subform in the data tab.

HTH
Scott<>
Answer -
Hmmm, Not sure why you wouldn't have been prompted. But its in the Properties Dialog on the Data tab. Select the subform, then right click it and select Properties. Go to the data tab and you should see Link Child Fields and Link Master Fields. These should be bet to SupplierID.

HTH
Scott<>

Answer
Let me address 2 first.

Whoa! what you are saying is just the OPPOSITE os what you really want. I almost never use Datasheet mode. You have much greater control over input in Form view. You can do much more validation and data checking in form view. You can use things like combos, listboxes and option groups to ensure the correct data. I think you need to rethink this. I was working on an app yesterday. Its a call log for machine servicing. I have it set so that when a new record is entered, all controls are open except one calculated control. Once the record has been saved, and returned to for editing, specific controls like the staff person who initiated the call and the start time of the problem are locked from editing. Once the machine has been fixed and the log entry completed, all data is locked.

As to question 1. I'm not sure if one can do that, but if you explain to me why you want to do it and what you hope to accomplish maybe I can help further. I would also suggest doing that in a new note as this one is getting long.

HTH
Scott<>

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.