Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBA code to refresh form data with out clicking button

Posted on 2004-04-02
4
Medium Priority
?
1,754 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 1000 total points
ID: 10742646
Try:
[Forms]![yourform].[yoursubform].requery   or
me.[Forms]![yourform].[yoursubform].requery

in the OnEnter event of the field

0
 
LVL 34

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

886 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