473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Adding one value to the value entered in the previous record

Hi,

I have a form that includes a subform with Days and SampleDates. I would like to know how to make access automatically populate the next record (in the subform) with the next day (i.e., Days + 1) and next day's date (i.e., SampleDate + 1). I don't know much about VBA and need some help. When a new Form record is created, the first record of the subform will have to be manually entered but I want all the subsequent Days and SampleDates for that Form's subform to be auto filled by one day/date. Any suggestions? I am a very BASIC Access user...
Jan 5 '17 #1

✓ answered by NeoPa

Your experience so far may be basic, but the question really isn't.

You need to ensure that the .DefaultValue property of the control on the form that shows this date is set, and set again where necessary, to match what is required.

The .DefaultValue property is a string value that is enterpreted when used. IE. Not always as simple as putting a few figures in there.

The code to set the value needs to be able to enquire from your database, or even of the current form itself, what the current maximum date is and if it even has one. This needs to be incremented and set as the .DefaultValue property (in the correct format of course).

I suggest you look into this, with these notes to guide you, and come back with your solution. I'm sure we can work from there if it isn't perfect first time.

3 999
NeoPa
32,556 Expert Mod 16PB
Your experience so far may be basic, but the question really isn't.

You need to ensure that the .DefaultValue property of the control on the form that shows this date is set, and set again where necessary, to match what is required.

The .DefaultValue property is a string value that is enterpreted when used. IE. Not always as simple as putting a few figures in there.

The code to set the value needs to be able to enquire from your database, or even of the current form itself, what the current maximum date is and if it even has one. This needs to be incremented and set as the .DefaultValue property (in the correct format of course).

I suggest you look into this, with these notes to guide you, and come back with your solution. I'm sure we can work from there if it isn't perfect first time.
Jan 5 '17 #2
PhilOfWalton
1,430 Expert 1GB
Have a look at my reply to

How To Get Access to Autofill Date Field From Past Date

Phil
Jan 5 '17 #3
NeoPa
32,556 Expert Mod 16PB
This thread (Item Numbering Within a Group) may be worth reading. The requirement isn't exactly the same but it certainly has strong similarities.

PS. Phil's linked answer is also well worth looking at.
Jan 5 '17 #4

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

Similar topics

2
by: Tony Schoeffler | last post by:
I have a data entry form used for adding records tied to a particular checklist number. I currently have to enter the checklist number on each new data entry form. It would be desirable to have...
4
by: | last post by:
Something really common I'm sure and I'm surprised it's not just a field property option. The previous record's field value can be retrieved and copied into the current corresponding field by...
2
by: nasse | last post by:
i found this code on the internet that copy value from the previous record to the new record. Private Sub Ordrenummer_AfterUpdate() Const cQuote = """" Me!Ordrenummer.DefaultValue = """" &...
3
by: Chris | last post by:
Is it possiable to have a iif function in a query where it looks at the next record. for example if I run the query which lists years and if the results in record 2 equals the result in record 1...
8
by: Jeff | last post by:
A client wants a press of the Enter key in a field on a continuous form to grab the value of that field from the previous record. But if they have typed a value and then hit Enter it shouldn't. ...
1
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same...
7
by: ivijayan | last post by:
i need help in developing macros in MS Access 2003. based on the data in field X in a previous record, i have to prompt the user to change the value of X in the prevous record before entering any new...
5
by: gismar | last post by:
Hi! I have projects that can each have several sub-projects, nested within a subform. Usually, each of the sub-projects contained within a master project, only differ in one or two text boxes....
1
by: hlock | last post by:
Access 2007 on XP - I have a table that has: claim trans date examiner 1 1/2/08 MB 1 1/2/08 MB 1 2/9/08 MB 1 5/21/08 DG 1 7/18/08 DG 2 1/5/08 KY 2 3/1/08 KY
4
by: dirtbooksun | last post by:
Sorry i don't have VBA experience but i'm working on a form in Access. Often there will be the same data from entry to entry as the previous record. So what i want to do is have a little button...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.