Bound fields in subform not updating table (1 Viewer)

105tt

New member
Local time
Today, 11:43
Joined
Feb 4, 2022
Messages
11
Hi, I have a subform where I have some bound fields tied to a temporary table . I have a save button where I execute an append query to append the data to the main table I need it in. (I am doing this to control the data entry through having to click a “save” button.) When data is entered into the fields, it does not automatically update the temp table right away but if I click on a different record, then the data finally shows up in the table.
Why doesn’t the data show up in the temp table without having to trigger it by clicking on a diff record? Is this normal ?? Is there a command I can add to my save button to force data to the temp table before doing the execute append query?

thanks!
 

105tt

New member
Local time
Today, 11:43
Joined
Feb 4, 2022
Messages
11
Actually just thinking now maybe all I have to do is put a command to go to next record right before my execute append query for the save button on click??
DoCmd.GoToRecord , , acNext
 

Gasman

Enthusiastic Amateur
Local time
Today, 18:43
Joined
Sep 21, 2011
Messages
14,046
Need to requery the form?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:43
Joined
May 7, 2009
Messages
19,169
why the need for temp table?

what is your subform, continuous form?
if so, add code to the Click event of the button:

private sub button1_click()
me.dirty = false
'your code to save to permanent table.
end if
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:43
Joined
Feb 19, 2002
Messages
42,971
(I am doing this to control the data entry through having to click a “save” button.)
Your time would be better spent learning how to use the form's events to do what you want. You have absolute control over whether or not data gets saved by using the correct event procedures. You can even enforce the rule that nothing gets saved unless you press the magic button. The only time it makes sense to use temp tables to collect data is if you are working with "batches" and the batch needs to balance before being applied to the database.

Since you are running an append query, you would need to requery the main form after you run the query in order to see the new data.

A recordset is opened when the form opens. It is kept in memory. Therefore, whatever you do to the underlying table is not visible to an open form until its RecordSource is requeried. Access refreshes the recordsources of bound forms so you will eventually see fields update or deleted records marked as #delete# but you will never see added records without the requery.

Are you just using this method when you add data or are you also using it to update data? If you are using two separate forms for Add/Update, are you duplicating the validation code in both forms?
 

Users who are viewing this thread

Top Bottom