Trying to keep data on form while setting recordsource to null? (1 Viewer)

Steven_Bash

Registered User.
Local time
Yesterday, 19:26
Joined
May 9, 2018
Messages
27
Hello!
I have this continuous form("billingreport") that has a lot of data grabbed from this query("query1"). The form is reproduced every month with new data values. So I want to 'Save it' with that specific month data being locked in. What I have right now is a cmd button on the form where to save the report, click on it, user input box pops up to name the new copied form then [(what i need help with)cut ties with the recordsource so it does not get updated]. In my mind I saw it as: Copy Form->Lock values of data->Remove recordsource. I haven't figured out a way to do so. Please help!
 

June7

AWF VIP
Local time
Yesterday, 16:26
Joined
Mar 9, 2014
Messages
5,465
Don't understand issue. If data is saved to table, it can be recalled at any time.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:26
Joined
May 7, 2009
Messages
19,231
you'll get errors in field if you set the recordsource to nothing.
After copying the data you might set the form's AllowAdditions, AllowEdits, AllowDeletions to False making your form uneditable and undeletable.
 

Steven_Bash

Registered User.
Local time
Yesterday, 19:26
Joined
May 9, 2018
Messages
27
-arnelgp: right, I understand that. and I have tried that setting the form allow... = false yet does not work for the data will still be updated.

-June7: The issue is that every month new values are placed into the table. So once I copy the billingreport form with the data for that month and move on to do the next month and copy the new month, the previous months data will get overwritten with the new months data aka the problem.

I want once you save(copy the form with its new name) to lock those values, not update/change when I proceed and do the next months.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 10:26
Joined
Jan 20, 2009
Messages
12,851
You need to append the data to a table each month then use a filter to get the records from the month you want to show.

Forms don't hold any data themselves. They just interact with what is in their RecordSource.
 

June7

AWF VIP
Local time
Yesterday, 16:26
Joined
Mar 9, 2014
Messages
5,465
You do not understand the use of forms. They are an interface for entering data into tables - as Galaxiom said, they do not hold data. They connect to table and read/save data.

Move to new record row to add the next month data. Code can be used to open form to new record row.
 

Steven_Bash

Registered User.
Local time
Yesterday, 19:26
Joined
May 9, 2018
Messages
27
-June7: what i had in mind is once the copied form gets the data, to set the form where it can hold the values regardless, locking those values. maybe that isnt possible i guess.

-Galaxiom: Okay, so if thats the way. Then once i append it i'd have to filter it by the billingdate which goes by month... how would I filter the saved form to grab the most recent imported data? Ie marchs data is imported and user saves it as March then the form will only grab the values of march’s(the most recent import)
 
Last edited:

Minty

AWF VIP
Local time
Today, 01:26
Joined
Jul 26, 2013
Messages
10,366
You can run a query to only return the latest data, and base the forms recordsource on that.

Personally, I would have one form to do both tasks, add new data by default, and a combo or listbox to select the historical date you wanted to display on the same form. You can block editing of existing records using suitable code on the form.
 

Steven_Bash

Registered User.
Local time
Yesterday, 19:26
Joined
May 9, 2018
Messages
27
Thanks all for the help I figured that out ! I did what Minty suggested except with 2 forms instead of 1.
 

Users who are viewing this thread

Top Bottom