Avatar of supergooner
supergoonerFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

VBA code to refresh form data with out clicking button

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?

Microsoft Access

Avatar of undefined
Last Comment
Mike Eghtebas
Avatar of walterecook
walterecook
Flag of United States of America image


me.refresh

in the OnEnter event of the field

Walt

Avatar of supergooner
supergooner
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

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.

ASKER CERTIFIED SOLUTION
Avatar of phileoca
phileoca
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
me!frm_material_group.Form.RecordSource=me!frm_material_group.Form.RecordSource
me!frm_material.Form.RecordSource=me!frm_material.Form.RecordSource
.
.

Mike
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo