Repeat last entry but automatically change 1 field.

Gabbelgak

New Member
Joined
Dec 14, 2016
Messages
22
Hello, I'm fairly new to access and have the following situation.

My database is set up where the user enters a record on a form for inventory tracking purposes with the following fields:
Date / Customer / Incoming / Name / Quantity

Incoming is either In or Out always and 9 times out of 10 if we are getting say for example 5 in we are also giving 5 out. So currently to track it we have to create 2 duplicate entries except change the In to an Out on the 2nd which slows data entry time in considerably.

I would like to create a button on my form that simply takes the last entered record from the user, duplicates it and then changes the in to an out.

Thank you for any assistance you can provide.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

welshgasman

Well-known Member
Joined
May 25, 2013
Messages
1,086
Office Version
  1. 2007
Platform
  1. Windows
Probably the easiest way as you only have 4 controls would be assign required controls to your own variables

MyDate = Me.Date

Add new record

DoCmd.GoToRecord , , acNewRec

The assign your variables to the controls

Me.Date = MyDate

Add a test for In or Out and swap the value for that control.

This will work on the current record of the user.

HTH
 
Upvote 0

Gabbelgak

New Member
Joined
Dec 14, 2016
Messages
22
Is it possible to do similar without any code? (When I transfer code between my home and work computer the work computer automatically deletes all code - Macro's are fine)

Thank you for the above though to get me started.
 
Upvote 0

Gabbelgak

New Member
Joined
Dec 14, 2016
Messages
22
I figured out a way, using similar to what you suggested. I created an invisible text box and just used it as a variable.
Store the value from your control using SetValue then retrieve it after moving to a new record by setting the value of the control to the invisible text box.
 
Upvote 0

welshgasman

Well-known Member
Joined
May 25, 2013
Messages
1,086
Office Version
  1. 2007
Platform
  1. Windows
I'd be looking at fixing that, as I do work at home as well when I have to, and that does not happen to me. I'd fully expect you to have to use VBA at some point, so it would be worth fixing.

Is it possible to do similar without any code? (When I transfer code between my home and work computer the work computer automatically deletes all code - Macro's are fine)

Thank you for the above though to get me started.
 
Upvote 0

Gabbelgak

New Member
Joined
Dec 14, 2016
Messages
22
I'd be looking at fixing that, as I do work at home as well when I have to, and that does not happen to me. I'd fully expect you to have to use VBA at some point, so it would be worth fixing.

I know the cause of it actually, not something I can fix unfortunately, I simply have to work around the limitations put upon the hardware I work with.
 
Upvote 0

welshgasman

Well-known Member
Joined
May 25, 2013
Messages
1,086
Office Version
  1. 2007
Platform
  1. Windows
Can you email the code to work and then paste it in there.?

Good luck anyway.
 
Upvote 0

Gabbelgak

New Member
Joined
Dec 14, 2016
Messages
22
Yes I can, However if I then export my work to home and bring it back in I have to repaste the code. So in using code I would have to keep a running a list of all items that have code to paste in every time I go to / from work.
 
Upvote 0

Forum statistics

Threads
1,191,499
Messages
5,986,916
Members
440,064
Latest member
Pluong91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top