Solved

VBA code to refresh form data with out clicking button

Posted on 2004-04-02
4
1,738 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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