UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Form Refresh, Access 2013    
 
   
tbs
post Jan 12 2018, 11:48 AM
Post#1



Posts: 263
Joined: 12-February 13



Hi -

I am sure this is a quick fix but I am unable to figure this out.

Problem:

- I have a Main form with several sub forms open.
- In one of the sub forms, it is a communication log.
- This communication log subform is locked (cant edit).
- This communication log has a command button to open a new form (call it frm_newCLR) to enter new record in the communication log. The Main form stays open.
- After frm_newCLR is closed, record is appended to the communication log table.

After I close frm_newCLR, I want the Main Form to be Refreshed so that the communication log subform will show the new record entered from frm_newCLR.

I've tried Refresh on:

- On Dirty
- On Got Focus

in the Property Sheet of the subform, but it didn't work.


Go to the top of the page
 
theDBguy
post Jan 12 2018, 12:11 PM
Post#2


Access Wiki and Forums Moderator
Posts: 71,395
Joined: 19-June 07
From: SunnySandyEggo


Hi,

How exactly are you opening the "other" form (frm_newCLR)? If you're not using acDialog, then you might try it.

Just a thought...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
tbs
post Jan 12 2018, 04:24 PM
Post#3



Posts: 263
Joined: 12-February 13



DBguy,

I'm sure there is a smarter way to do this, but this is how I set it up:

I created a temp table (tblLog_temp) and a blank form (frm_newCLF) that looks like the regular communication log form (and table).

The command button opens frm_newCLF in front of the main form.

User will populate info on frm_newCLF. When done, user will close the form. A VBA is written to close the form, append record from temp table to main table, then empty the temp table. The VBA looks like this:

CODE
On Error GoTo CloseNewLog_Err

    DoCmd.Close acForm, "frm_newCLF"
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Append_tblLog", acViewNormal, acEdit
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Delete_tblLog_temp", acViewNormal, acEdit
    DoCmd.SetWarnings False
    DoCmd.RunCommand acCmdRefreshPage
        

CloseNewLog_Exit:
    Exit Sub

CloseNewLog_Err:
    MsgBox Error$
    Resume CloseNewLog_Exit


What I am missing is the refresh Main form that has the communication log in the subform. I can hit Refresh to get the latest records but I want it be done with VBA. I thought DoCmd.RunCommand acCmdRefreshPage would do that for me.
Go to the top of the page
 
theDBguy
post Jan 14 2018, 10:39 AM
Post#4


Access Wiki and Forums Moderator
Posts: 71,395
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Where is this code you posted located? On the main form?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
tbs
post Today, 11:23 AM
Post#5



Posts: 263
Joined: 12-February 13



Sorry I didn't reply back. The email notification was turned off.

Anyway, to answer (DBguy's) question, the code is located on the command button on frm_NewCLF.
Go to the top of the page
 
theDBguy
post Today, 11:38 AM
Post#6


Access Wiki and Forums Moderator
Posts: 71,395
Joined: 19-June 07
From: SunnySandyEggo


Thanks. Can you post the code on the main form, which opens frm_NewCLF?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
tbs
post Today, 11:53 AM
Post#7



Posts: 263
Joined: 12-February 13



I added: Me.refresh on the frm_newCLR and got this message:

"The expression you entered refers to an object that is closed or doesn't exist."

That's because frm_newCLR. I wanted the me.refresh to refresh the main form.


To answer (DBguy's) question, the main form has a command button behind a macro that OpenForm frm_newCLR.

The property sheet's Event tab has nothing on it.
Go to the top of the page
 
theDBguy
post Today, 11:54 AM
Post#8


Access Wiki and Forums Moderator
Posts: 71,395
Joined: 19-June 07
From: SunnySandyEggo


Okay, can you post the macro? Thanks.

I am trying to get you to use the Dialog mode...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    16th January 2018 - 12:44 PM