Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoFill of fields... a clear understanding is needed 2

Status
Not open for further replies.

Niki

MIS
Mar 23, 1999
21
0
0
CA
I have started to develop a dbase for maintenance workorders. I have developed the following tables: Employee, MWO details, and Trade.<br>
<br>
In the EMPLOYEE table I have fields: employee name, badge (primary - YES No dups), trade<br>
<br>
In the MWO Details table I have fields: MWO Number, MWO Details, MWO assigned to...(with a combo box that has the badge & employee name)& finally Trade Title.<br>
<br>
In the TRADE table I have fields: Trade (Yes No dups), ID (primary key)<br>
<br>
My question is...... When in MWO Detail FORM.... how can I have the TRADE and EMPLOYEE NAME fill in when I enter the employee badge? What relationships... if any... do I need?<br>
<br>
Should I be using SUBFORMS?<br>
<br>
I have searched the forum for reference made to this and have found a few... but I am still unclear. If someone would help me out this would be appreciated. Also, if there are some related sites that provide clear info and even examples on this I would be interested in these as well. Thanks in advance!<br>

 
Interesting. I'd assume that an employee is associated with a trade <i> (hint) </i>; and if allowing for more than a single trade per employee; you'll need <i>employee/trade </i> entries. I assume that the 'TRADE' table serves as a&nbsp;&nbsp;'look-up' for the names of trades (to be associated w/ 'EMPLOYEES'). So to create a given list of employees w/ a specific trade we select from employees where employee.tradeID = ID_WERE_LOOKIN_FOR. This suggests that the trade is assigned to employeeID <i> first</i>, and then . . . <br><br>For employee badge criterion; if you've allowed multiple 'Trades' for each employee, you'll have to deal w/ multiple records being returned for the <i>badge number</i> (contained in the WorkOrder record of course!) Just use 'distinct' clause. No big deal.<br><br>And oh, yes. Do use a sub form.<br>&nbsp; <p>Amiel<br><a href=mailto:amielzz@netscape.net>amielzz@netscape.net</a><br><a href= > </a><br>Amiel
 
Thanks Amiel for your response. I am going to try this right now, but I just wanted to say a quick thank-you. The employee is associated with ONE TRADE only. The trade field is used for lookup purposes only. I will let you know of any success or if I need further help. Cheers!
 
Based on your response that there will be only one trade per employee, I would recommend an alternate structure:<br><br>tblEmployee: EmployeeID, TradeID, other desc (FirstName, LastName, Address...)<br>tblTrade: TradeID, other decriptive fields describing that trade.<br>tblOrder: OrderID, any descriptive date about order (like date etc.)<br>tblOrderDetail: OrderDetailID, EmployeeID<br><br>tblEmployee 1:n tblOrderDetail<br>tblOrder 1:n tblOrderDetail<br>tblTrade 1:n tblEmployee<br><br>You can use a form based on Order with a subform based on OrderDetail. In the form should be a bound combobox.<br><br>Re: showing Employee-related data, there are several ways to do it. If you need to <i>capture</i> the EmployeeID but only want to <i>display</i> Name and Trade, here's a sort of easy way to do it:&nbsp;&nbsp;<br><br>1. Write a query using&nbsp;&nbsp;tblEmployee and tblTrade. Column1 would be EmployeeID and the second column would be something like this (you have to key it in where the field name usually goes in the query grid):<br>&nbsp;&nbsp;&nbsp;&nbsp;NameAndTrade: FirstName & &quot; &quot; & LastName & &quot; - &quot; & Trade<br>&nbsp;&nbsp;&nbsp;&nbsp;This would show up as something like:<br>&nbsp;&nbsp;&nbsp;&nbsp;John Smith&nbsp;&nbsp;- Carpenter<br>2. Go into View/SQL and copy this SQL stmt.<br>3. Go into the RowSource of the combo and paste it in there. <br>4. Set the combo's ColumnCount property to 2, and the ColumnWidth to&nbsp;&nbsp;0,3<br>&nbsp;&nbsp;&nbsp;&nbsp;You can modify that second number to whatever width you need to display<br>
 
Elizabeth... thank-you for your response! I am thrilled to have received yours and Amiels. I have printed your reply and will be trying these out hopefully today. I do appreciate the help and I will let you know the results. Cheers!
 
Good luck :) But first... a correction:<br>tblOrderDetail: OrderDetailID, OrderID, EmployeeID
 
Elizabeth.... I was just reviewing my print out and I should have made a note of this in my first reply.... being a somewhat novice... can you tell me in your respone where you have the 1:n ... (what is the n?) I am assuming that it is One to something! I apologize for my daftness. Usually I understand, but this one I don't.<br><br>Thanks for the amendment as well! :) I am about to attempt your instructions.
 
That's the generally used notation for &quot;1 to many&quot;. <br><br>You know how people use &quot;x&quot; to mean a single unknown, people generaly use &quot;n&quot; to stand for the final number in a range of unknowns. As in:<br><br>For counter = 1 to n<br>&nbsp;&nbsp;&nbsp;&nbsp;Do whatever<br><br>So 1:n means &quot;from 1 to some unknown number&quot; and actually it can include 0.<br><br><br>
 
okay... so here's what I have done so far!<br><br>created allllll the tables and the fields that you suggested. Did the form...... BUT having trouble creating a BOUND combobox...... so I went to the next step ANYWAYS.... and created the query as suggested........... NOW.... I am on STEP #3 of your instructions and I cannot find that darn RowSource of the combo to paste the SQL stmt. When I was having problems creating the BOUND combo, would that be related to my RowSource issue? That's where I am at.<br><br>Thanks and cheers...Niki
 
Elizabeth.... here I am again. Found my row source and all that other stuff. But it is still an UNBOUND object. AND... when I use my SQL statement as your suggestion.... well I get a PROMPT asking me for a TRADE .... I enter in a trade... ELECTRICIAN.... and when I go to select an employee they are ALL electricians! I just can't get this thing working. I'm not too frustrated... but its lunch time and I will be okay! If you have a moment to help me I'd appreciate it. I'd even send you cookies or donuts if that would help?! But your steps were very helpful and I am pleased so far. Its just my ignorance that gets in the way! I am taking classes Mon Tues April 3/4 so that should help! Cheers for now... Niki
 
To make a bound combo, go into the form in design mode and click on the field list icon on the toolbar. If EmployeeID or whatever is not in there, add that field to the query, that's the source of the items in the field list. Drag and drop the item in the field list that you want the item bound to onto the form. . If it is not a combo by default, right click on it and select Change to... combo.
 
The previous replies were thoughtful but perhaps too much horse for the cart, so to speak.<br><br>?&nbsp;&nbsp;Is there more than one employee sent on a given WO?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(I'll assume it's possible if not common)<br><br>Then, think in terms of DB structure before going into programming or Access specific features.<br><br>1. There are MANY trades but employee has ONE<br>2. There are MANY work orders and MANY employees per order.<br><br>So break (2) down into underlying one-to-many's thus:<br><br>Each WO Detail table entry has a Emp/WO# combination that is unique although the Emp# and WO# ID's can appear in other combinations.<br><br><br>TRADE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EMPLOYEE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;&nbsp;WO#1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Emp#02<br><br>Bob & Betty are both plumbers and they got sent on the same job.&nbsp;&nbsp;The same job ID appears, but the combinations of job and emp # are unique (concatenated primary key)<br><br>To have the trade appear automatically, which is feasible since the trade is linked to each employee, you'll need to <br>build a query that shows the trade for each employee based on the link.&nbsp;&nbsp;You can then build a form upon the query to show all of it.&nbsp;&nbsp;<br><br>From a fellow beginner.<br><br>
 
Yea. O.K. Seems like we have a thing going here.<br><br>Do, by all means identify the 'wizzard' Icon on the 'tools' tool bar. And use it. Every successful programmer does these days. That is; any tool that is available that gets the job done and saves time too, well, we use them.&nbsp;&nbsp;Wizzards are great! <br><br>Suggestion. When creating a list box or combo box use the wizzard. If you haven't created the query, or table that the wizzard will use to create the combo box for the form. <br><i>Stop</i> and create the query or table. Take all day. Then examine the code that the wizzard has generated. This is the <i>functionality</i> that we are after. Code that actually does something usefull (without having to think about it all that much). Routine stuff. O.K. I'm leaving for Washington D.C. early next week so what are the chances of getting this thing <i>up and running</i> before then?<br><br><br><br><br><br><br> <p>Amiel<br><a href=mailto:amielzz@netscape.net>amielzz@netscape.net</a><br><a href= > </a><br>Amiel
 
Sumwhat, what am I overlooking in your response? Your suggestions for table structure look <i>identical</i> to mine, ditto relationships.
 
Elizabeth,<br>You're quite right!&nbsp;&nbsp;I realized after that I hadn't read your submission(s) thoroughly enough. I just wanted to parse the SQL since the user appeared to be at a very primitive stage of use (yours truly at perhaps one remove from same. . .)&nbsp;&nbsp;&quot;sumwhat&quot;
 
Everyone here is WONDERFUL! I will be working on this from home on Saturday and will respond with results sometime that day. Thanks to everyone. I am taking classes Mon/Tues at the college here in the city. And I tend to make more use of Access as I progress thru the training. I am EXTREMLY pleased with this site as the input has been overwhelming. Cheers to all.... Niki
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top