By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,226 Members | 1,435 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,226 IT Pros & Developers. It's quick & easy.

posting data from one record into the next record

P: 39
I am using Access 2003.

I have a form that has text boxes labeled Position 1 T1, Position 1 T2, Position 2 T1, and Position 2 T2. When I create a new record, I want the same values to save into the new record unless a yes/no check box is selected on the new record (I also would like to gray out the entry altogether for update unless the check box is selected-that I found). I have looked all through the properties and can find no way to do this.

Any help is greatly appreciated.
May 26 '09 #1
Share this Question
Share on Google+
14 Replies


P: 39
I just had a thought on this (do not know if it would work):

I think I could place a button on the form that would first record those fields as a number (i.e. numP1t1, numP1t2, numP2t1, numP2t2), then move to a new record and place those variables into the correct fields. I can gray out the area by using an IF statement on the check box.

Would something like that work?

Thanks
May 26 '09 #2

NeoPa
Expert Mod 15k+
P: 31,707
A way to do this which would not be clumsy and not set the Dirty flag, would be to handle setting the defaults for the various controls depending on the CheckBox you mention.

A default value only ever has an effect when the record is created.
May 26 '09 #3

nico5038
Expert 2.5K+
P: 3,072
There's a nice working sample database in the Access CookBook:
http://examples.oreilly.com/accesscook/CDROM/chap09.zip
The fifth sample (0905.mdb) is the one you need..

Can recommend the book :-)

Nic;o)
May 26 '09 #4

P: 39
That worked! Thanks for the help. I used the exact code from your example and a checkbox to clear it when needed. I also went out and got the book.

Arli
Jun 1 '09 #5

nico5038
Expert 2.5K+
P: 3,072
You're welcome.
Always great to see that people want to improve their skills :-)

Nic;o)
Jun 2 '09 #6

P: 39
I have one more question. I used the code almost verbatim from the example (chainging the names where needed). I was wondering if there is a way to do the same thing by tying multiple values to the same toggle switch? What I want the operators to be able to do is select the toggle switch and that one switch would pull all the data forward into the new form.

Hopefully that makes sense.

Thanks
Jun 2 '09 #7

nico5038
Expert 2.5K+
P: 3,072
Hi Arli,

In case of multiple (excluding) values the general approach is to use a frame with radio buttons, one for each value. Such a frame (see the toolbox symbol with the square and text top left) with round radio buttons will be an intuitive way for the user to select a value and the frame can be bound to the field holding the value.

Getting the idea ?

Nic;o)
Jun 2 '09 #8

P: 39
I will give that a try. Another thing to note (I was just testing the form). The code pulls the data from the first form forward. I set the toggle buttons so that the operators cannot change them, then put a check box on the form to clear those fields if new data is required. When I check that, it clears out the fields and allows the input of new data. The problem is that now the code appears to not work (when I create a new record at this point, the old data from record 1 is pulled into record 3).

That is the reason for the previous question. Using radio buttons may help me on that (because I need two checkboxes).
Jun 2 '09 #9

nico5038
Expert 2.5K+
P: 3,072
Keep me posted. When you find no solution, then attach a small sample .mdb so I can check the form. (Use the [Edit] after posting your comment to add an attachment)

Nic;o)
Jun 2 '09 #10

NeoPa
Expert Mod 15k+
P: 31,707
@nico5038
That's no longer necessary Nico.
To attach items to one of your posts you need to scroll down the page a little when posting (either originally or in an advanced edit screen) to the button that says Manage Attachments. Pressing on that leads you to a page where you can add or remove your attachments. It also lists the maximum file sizes for each of the allowed file types.
Jun 3 '09 #11

P: 39
Here is a copy of the database. In the form, I disabled the toggle buttons because I want to pull the data forward until the NewSetup check box is selected. As it works now, when I enter data into the first record, it pulls it to the second record. Once I input the second record, I go to the third (it still pulls forward the data-but I think it still getting it from the first record). On the third record, I select the checkbox for the NewSetup, that then clears the data (but does nothing to the toggle switches). I input my new data. Click on new record (which should then pull the new data forward), and the fourth record shows data from the first record still. If you want to try it out, use the following data.

Select New Work Order
then enter anything for Part number
enter anything for Serial number
check that the box exhibits 100% coverage
Leave the pulled forward data in there.
enter a number for machine timer
enter a number for both badges.
click new work order

On this one, select the checkbox for First Part on new setup.
then follow the above instructions and enter numbers into the Position1T1-Position4T2 fields.
click new order.

It should pull forward the 1.1234 from the first record.

Sorry if I am to detailed in this. I want to duplicate it exactly.

Thanks for your help.
Attached Files
File Type: zip ShotPeen.zip (103.2 KB, 46 views)
Jun 3 '09 #12

nico5038
Expert 2.5K+
P: 3,072
Attachment ?

:)

Nic:o)
Jun 3 '09 #13

P: 39
I could have sworn it was there....yea, right. Doh!
Jun 3 '09 #14

nico5038
Expert 2.5K+
P: 3,072
The present mechanism will "store" the value that's present in the text field when the toggle button is pressed. Changed values won't change this default value. Only a deselect and selecting the toggle again will set the newly entered value to being carried forward.
When you want to carry forward the last entered value, then an additional function is needed that handles the AfterUpdate event of the text value.

I've created such a function and applied it to the first field "POSITION 1 T1" by adding the function call to the AfterUpdate event and placing the toggle name in the tag property. Guess you can handle the remaining fields :-)

Nico
Attached Files
File Type: zip ShotPeenNico5038.zip (40.2 KB, 52 views)
Jun 3 '09 #15

Post your reply

Sign in to post your reply or Sign up for a free account.