473,387 Members | 3,750 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,387 software developers and data experts.

Auto populate date field based on first date field

4 Nibble
Hi. New to Access and would appreciate any help!

I'm working on a Multiple Items form and want to populate the date field in the 2nd, 3rd, 4th, etc. line with the date selected in the 1st line.

Example: 1st line = 7/25/20
2nd, 3rd, 4th, and on = same date
Jul 25 '20 #1
5 6029
isladogs
455 Expert Mod 256MB
if you are happy to copy the date in the previous row manually, just click Ctrl+' (apostrophe).
However if that's not suitable for your needs, why not search for something like "Access Fill Down to Emulate Excel Fill Down".

Hope that helps
Jul 25 '20 #2
cactusdata
214 Expert 128KB
Have a button to run this simple code to fill/update the date field of the records using the RecordsetClone, thus update the form instantly:

Expand|Select|Wrap|Line Numbers
  1. Private Sub FillDateButton_Click()
  2.  
  3.     Dim Records     As DAO.Recordset
  4.  
  5.     Dim FirstDate   As Date
  6.  
  7.     Set Records = Me.RecordsetClone
  8.  
  9.     If Records.RecordCount > 0 Then
  10.         Records.MoveFirst
  11.         FirstDate = Records!YourDateFieldName.Value
  12.         Records.MoveNext
  13.         While Not Records.EOF
  14.             Records.Edit
  15.                 Records!YourDateFieldName.Value = FirstDate
  16.             Records.Update
  17.             Records.MoveNext
  18.         Wend
  19.     End If
  20.     Records.Close
  21.  
  22. End Sub
Jul 26 '20 #3
jimatqsi
1,271 Expert 1GB
In CactusData's code, addd
Expand|Select|Wrap|Line Numbers
  1. if me.dirty then me.dirty=false 
prior to line 7. That will make sure there are not any unsaved changes before you get into the code.
Jul 28 '20 #4
Naheedmir
62 32bit
You have to give the same field names for all those fields in which you want to have the same value. Select all fields and click on the Binding tab. Then in the default binding, click on Global. Thus now, when you enter a date in the date1 field, it will show the same value for all selected fields.
Aug 6 '20 #5
dylankirs
4 Nibble
Thank you to everyone that replied. I decided remove the date field. Hope these answers help someone else with this problem!
Aug 25 '20 #6

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

Similar topics

1
by: Angela Byars | last post by:
I imported several .dbf's from another application to use as the basis for my form. In addition to displaying the records that were created with the original application my users will be adding...
2
by: Mike | last post by:
I'm sure this has been covered before in the newsgroup but have had no luck locating it. I have two tables: InstMonitors & MonModDesc Structure of MonModDesc: Model, Description Structure...
1
by: itfgnanvigneshwari | last post by:
hai, as i am new to php field i had a problem in date field. i have table named student with fields fieldname type name varchar...
4
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt...
2
by: Ronald | last post by:
I hope somebody can help. I can't get into the specifics of my project, but I'll try to create a simple example: tblVehicle * VIN (text box) * Make (text box) * Model (text box) frmRepair
10
by: dkyadav80 | last post by:
<html> /// here what shoud be java script for: ->when script run then not display all input text field only display selection field. ->when user select other value for institute only this...
7
by: nhkam | last post by:
I am using MS Access 2007 I have a transaction table which holds all records with posting date on each of them. I used a make table query to find out the max date hold in the transaction table and...
9
by: yappy77 | last post by:
I want my "requalify date" to auto populate to the beginning of the month in the following year when my "liability date" gets entered/changed. Example: Liablity date = 11/15/2010; 7/31/2011 ...
7
by: danaluter | last post by:
Hi: I have two fields, First follow up date sent email. I want the second field, Second follow up date sent email, to auto populate seven days into the future. this is on a Access form. How and...
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.