Solved

Controls on a form not HIDING as they should

Posted on 2016-10-04
3
61 Views
Last Modified: 2016-10-05
I have a simple form plays an audio file to ask a child a question.  While the audio is playing I wanted to hide two images that represent a YES and NO for them to touch their answer.

My problem is when the code is in the same SUB as the audio file player, it won't hide it.  It will UNHIDE them after the audio plays.... and I can use the exact same line by itself from a button and it works.   (Me.Image19.Visible = False)


Private Sub DinoImage_Click()
On Error GoTo ButtonError

Me.Image19.Visible = False
Me.Image20.Visible = False

Dim stID As String
stID = Me.ID.Value
sndPlaySound "C:\HospitalIntake\Audio\Q" & stID & ".wav", SND_ASYNC

Me.Image19.Visible = True
Me.Image20.Visible = True


Exit Sub
ButtonError:
DoCmd.Echo True
DoCmd.SetWarnings True
Dim stErrMSG As String
stErrMSG = MsgBox(Err.Description)
End Sub

Open in new window

ScreenShot.PNG
0
Comment
Question by:TechGuise
[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
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 500 total points
ID: 41828369
Generally, I don't hide buttons, instead I would set the Enabled property to true or false.

Try inserting a line:

DoEvents

or possibly

Me.Repaint

right before the line that plays the sound file.
1
 

Author Comment

by:TechGuise
ID: 41828389
"Me.Repaint" did it thanks.  

I agree, most of the time switching ENABLE to false is good enough.  But they're going to be handing these tablets to pretty small kids.   Thought it better to just hide them while question is playing.  Some of the questions are longer than others, didn't want them trying to answer before entire question has been read.
Thanks again.
0
 

Author Closing Comment

by:TechGuise
ID: 41830305
Thanks!
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Use Windows Task Scheduler to print a Word document weekly so your printer ink won't dry out.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

624 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