We help IT Professionals succeed at work.

Checkbox fixed information into Access table

Medium Priority
Last Modified: 2020-02-09
Hi experts,

I need your help for a button or something like that to keep repeating a certain value until the button is unchecked.

Daily we insert around 40 recordsets of daily production into a Acces table. A split form is used for friendliness to insert data into a table.

Now certain informations for that period stays the same, like the date, the user, location and so on. Only a small part is new. But the information that is fixed for that period also needs to go into the table.

At the moment we have to reinsert the fixed information for that period manually. How can we automate this with a button or checkbox?
Watch Question

John TsioumprisSoftware & Systems Engineer
Distinguished Expert 2019

Use a checkbox or toggle button to initiate the holding of information to Form-scoped variables.
For example you have field1,field2...fieldn that you need to repeat them.
So just after
Option Compare Database

Open in new window

Dim mfield1 as Integer
Dim mfield2 as String
Dim mfieldn as Date

Open in new window

and in the Current event
If me.chkBoxRepeat then
me.field1 =mfield1
me.field2 = mfield2
me.fieldn = mfieldn

Open in new window

and of course in the After Update of each field
mfieldn = me.fieldn

Open in new window

Most Valuable Expert 2015
Distinguished Expert 2018


You don't need a button or the like, do it automatically in the AfterUpdate event of the form by setting the DefaultValue of the controls, like:

Me!OrderDate.DefaultValue = Me!OrderDate.Value
Me!UserID.DefaultValue = Me!UserID.Value
Me!LocationName.DefaultValue = "'" & Me!LocationName.Value & "'"      ' wrap text in quotes.
Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010


I would go with Gustav's recommendation, that is what I do.  Then, when you uncheck the checkbox or un-toggle the button, just set those default values back to NULL.


Gilberto SanchesFreelance ICT Consultant


Okay, haven't applied the steps yet.. will do it soon. Thanks for the advise so far.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.