Solved

VBA code to refresh form data with out clicking button

Posted on 2004-04-02
4
1,745 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

617 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