Solved

VBA code to refresh form data with out clicking button

Posted on 2004-04-02
4
1,708 Views
Last Modified: 2007-12-19
I am an access beginner so please excuse simple question.

I can refresh my form data by having a button on the form generated by a wizard. This works fine and has the code:

Private Sub Command12_Click()
On Error GoTo Err_Command12_Click


    DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_Command12_Click:
    Exit Sub

Err_Command12_Click:
    MsgBox Err.description
    Resume Exit_Command12_Click
   
End Sub

I want to get the same effect by using code on the enter property of a field so the form is automatically refreshed when the user selects the field.

please could I have the code to do this?

0
Comment
Question by:supergooner
4 Comments
 
LVL 17

Expert Comment

by:walterecook
ID: 10742531

me.refresh

in the OnEnter event of the field

Walt

0
 

Author Comment

by:supergooner
ID: 10742622
Hi Walt

I have tried this and it does not work.

The button is on the main form and when it is clicked all subforms are refreshed.

The field is in a subform and i want  the data to be refreshed in a further subform which is linked to it.

ie. frm_material_group is the main form, frm_material is the subform with the user field in it which I want toi trigger the refresh and finally frm_material_colur_specific is the subform which needs it data refreshing.

0
 
LVL 11

Accepted Solution

by:
phileoca earned 250 total points
ID: 10742646
Try:
[Forms]![yourform].[yoursubform].requery   or
me.[Forms]![yourform].[yoursubform].requery

in the OnEnter event of the field

0
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 10742755
me!frm_material_group.Form.RecordSource=me!frm_material_group.Form.RecordSource
me!frm_material.Form.RecordSource=me!frm_material.Form.RecordSource
.
.

Mike
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now