Copying multiple records from one table to another and other stuff

Lateral

Registered User.
Local time
Today, 03:56
Joined
Aug 28, 2013
Messages
388
Hi guys

I'm a newbie and have been playing around with the attached Access 2007 database for about 2 weeks now trying to figure some things out and to teach myself a bit about Access 2007.

Some things I have managed to figure out for my self (Google and reading) and other things with the help of people in the forum which I really appreciate.

The main problem I have now is the following and I have been pulling my hair out and running around in circles so I have decided to post this thread:

The attached database is actually based upon one from the Microsoft website.

It basically is used to create, manage and track Customers, Parts, Work Orders and Suppliers, payments and employees.

You simply create a Customer and then create a Work order that contains a list of parts and labour items.

What I want to do is to create a "Kit" of parts so that the user does not have to select each part individually when they create a Work Order. For example, if I use a mechanics workshop as an example, the mechanic may sell his "Signature 1916cc Engine" that consists of 40 different parts and some other items such as labour and other services. In this scenario, instead of the user individually selecting 40 different parts, all he needs to do is select the Kit called "Signature 1916 cc Engine" from a drop down list and all of the 40 parts and other items would automatically populate the correct Work Order Parts/Labour tables.

I would also like the user to be able to select another "kit" that would either replace all parts and labour records or append to what is already there.

I have changed the form called "Workorders" to have 2 buttons. One called "Load Kit" the other called "Save Kit".

If the user presses "load Kit" a form will be displayed that enables them to select a "kit" from a list and whether they want to replace all of the existing parts and labour records or if they want to append to the existing records.

In order to create a new kit, the user can simply manually create a new work order by individually selecting each part and labour item and then pressing the "Save Kit" button. The user will then be asked to provide the short name of the Kit and the long description (I have created table called tKit). The new kit will then be saved.

I have tried unsuccessfully to remove an annoying issue when saving Workorders. It appears that the "Entered by" field that is linked to the Employee table must not be blank other wise the Workbook is NOT saved....I have tried to figure out why this is happening but can't!:mad:

The Work Order Parts are stored in "Work Order Parts" and the Work Order Labor is stored in a table called "Work Order Labor". I have created 2 extra tables called "tKitWorkOrderParts" and "tKitWorkOrderLabor" that I assume will contain the items that make up the kits....



Thanks for any help you can provide as I having a bit of a struggle.

Regards
Greg
 

Attachments

Last edited:
I can't figure out how to get to this...

I have tried unsuccessfully to remove an annoying issue when saving Workorders. It appears that the "Entered by" field that is linked to the Employee table must not be blank other wise the Workbook is NOT saved....I have tried to figure out why this is happening but can't!

I can't even create one to save one. Please provide step by step instructions...
 
Hi Gina

Give me a few minutes and I'll provide a step by step.
 
Ok, here it is:

1. Open the database and you should be presented with the "Work Order by Customer" form displaying James Natsuhara.

2. Halfway down the screen you should see all of the Work Orders attached to James' record. There should be 8 of them.

3. Double click "Work Order ID" number 1 and the "Work Orders" form should be displayed for Work Order # 1. It contains a number of parts and labor items. With an amount outstanding of $7533.85.

4. You will see the 2 buttons that I have created called "Load Kit" and "Save Kit".

Let me know if you need anything else...

Regards
Greg
 
I got that... I can't figure out how you are having a problem saving the record (I don't see where you are saving) and it is not letting you do so because entered by is blank.
 
BienneSoftX 1.0 Type Library is a YouTube Downloader. Why is there a Reference to that under Tools within the database? I unchecked it. I don't have it so I had to open by holding down the Shift Key or I get errors.
 
Hi Gina,

Remember that this is a template that I downloaded from Microsoft so that I can teach myself Access. I'm trying to figure things out as I go and work my way through it piece by piece. Regarding the requirement that "Entered By" by be entered otherwise the Work Order is not saved.....I cannot find any code that makes the "EmployeeID" field on the form mandatory......I'm sure it's there somewhere. I want this restriction removed so that the entering of an Employee Id is not required to create and save a Work Order.
 
I just checked and it is installed on my PC.

Where are you seeing it in Access and how can I find it?
 
Hmm, you said it didn't save... I'm asking how do you create a new one because I created a new one and it saved with no Entered by. Also, please see my post 6... I want to know why that Reference is set. It will not be loaded if you plan to distribute this database and will cause problems.
 
1. Open database
2. Click Ctrl + G
3. On the Menu select Tools > References

You will see it checked there.
 
OMG... These Microsoft Templates make me crazy. :banghead: Okay, it's after 1:00 AM here and I need some sleep. So, I'll look more into this tomorrow. In the meantime...

Homework :D
You need to create and APPEND query to add the records and then an UPDATE query to add Kits to the table (or you could add to the APPEND query. Then you'll be needing a DELETE query if the person changes their order or a mistake is made. Get those done and upload a new sample. Then we can figure out where to put the buttons (though you might need to add some forms.

Okay, I have another question... did you put these look-up fields in the tables? No matter, they got to go, see...
http://access.mvps.org/access/lookupfields.htm
 
Ok, Here are the steps to successfully create a new Work Order based upon continuing on from my previous "step by step"

5. Using the scroll arrows, scroll to the last record, # 8 and then press the scroll arrow to created record # 9. You will notice that the "Work Order ID" field located in the top right hand corner is set to "New".

6. Select an employee in the "Entered by" Combo box. The "Work Order ID" will change to a valid number.

7. Move down to the Parts tab and select a few parts....you will notice that the "Work Order ID" field is still set to "New".

8. To save the record, simply scroll to the next record.

If you first enter the parts and then the "Entered By", the selected parts will be deleted.

I hope this helps.

Regards
Greg
 
Yeah, good to see the templates drive you crazy as well! :)

Nope, the LookUps in the tables where already there....I was going to include one in the Customer table for the Postcode but decided not to after posting a question on the forum.

Also, good to know about the YouTube downloader....

I'll do my homework :D

Have a good sleep!

Regards
Greg
 
Hi Gina

Please see the attached database.

I've attached some code to the "Save Kit" button...it works but is not elegant :):).

You need to select something in the Kitname Combo box before clicking the "Save Kit" button.

Also, you need to delete the records in the tKitsWorkOrderParts table prior to running it again.

It the real world, prior to pressing the "Save Kit" button, they would need to enter the Name and Description of the new Kit...obviously they should not be able to add duplicate Names into the Kits table, tKits.

Regards
Greg
 

Attachments

Okay, well, I followed the steps to create a new Workorder and this...

. Move down to the Parts tab and select a few parts....you will notice that the "Work Order ID" field is still set to "New".

...did not happen to me. It stayed on Workorder 20. BUT I did get rid of the two References that are causing issues with the database. If you insist on leaving them in there you are going to have problems. One is that YouTube Downloader (and I am really tired of that one because in the database it serves no purpose) and the other is Microsoft Visual Basic for Applications Extensibility [vbe6.dll] 5.3. I uploaded a clean one (where those References have been unchecked.)

Okay, I pressed the button and nothing got appended so obviously I did something wrong. Going to need step by step for that.
 

Attachments

Hi Gina

Here is the complete step by step to create a brand new Work Order attached to Customer James Natsuhara (Customer ID=1). I'm using the database that you sent me dated 9.6.2013.

1. Open the database and you should be presented with the "Work Order by Customer" form displaying James Natsuhara. Customer ID=1.

2. Halfway down the screen you should see all of the Work Orders attached to James' record. There should be 9 of them. 1,2,12,14,16,17,18,19 and 20.

3. Double click "Work Order ID" number 20 and the "Work Orders" form should be displayed for Work Order # 20. It contains 2 part items and has a $0.00 amount due because the Qty fields for the items are 0.

4. Using the record scroll arrows, scroll to the next (it should say "10 of 10". You should notice that the "Work Order ID" field located in the top right hand corner is set to "New".

5. Select any employee in the "Entered by" Combo box. The "Work Order ID" will change to a 21 which is the next Work Order number that is available.

6. Move down to the Parts tab and select a few parts....you will notice that the "Work Order ID" field is still set to "New".

7. To save the record, simply scroll to the next record or close the form.

8. If you closed the form in step 7, then you will be taken back to Work Orders by Customer Form and you should see Work Order ID 21 listed.

Let me know how you go.

Regards
Greg
 
No, no, I got the Work Order created just fine with no issues. It was the *Save Kit* button I couldn't get to work. Please use the one I sent back and see if you can get it to work.
 
Sorry Gina,

Do this to get the Save Kit button to work:

1. Delete all records in the table tKitsWorkOrderParts
2. Select a Work Order that has some parts records.
3. Select an item from the Kit Name Combo Box.
4. Press the "Save Kit" button.

You should see a Message displaying the ID number of the Kit that you selected., then another message about appending 28 records and then another about updating 28 records. If you then look at the tKitsWorkOrderParts table you will see the copied and modified records.

Regards
Greg
 
Okay, well something doesn't work there cause it APPENDS Workorder 12 no matter what Workorder I am on. Don't think that is suppose to happen...

Almost 3:00 AM... going to get some sleep! Will check later today for messages.
 
Last edited:
Hi Gina

If you look at the code behind the button, WorkOrder 12 is hard coded. I did this as I was not sure how to use the form variables in the SQL statement so I thought that I could at least get the code sort of working with some hard coding and then I could work out how to implement the variables I needed.
 

Users who are viewing this thread

Back
Top Bottom