[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

I need your help to ammend this code

Posted on 2002-07-22
4
Medium Priority
?
157 Views
Last Modified: 2010-05-02
Hi,

Please read the following code:

Private Sub Command1_Click()
Dim CLA as string

Me.Combo1.Visible = True
ClA = Me.Combo1.Text
Me.Adodc1.Recordset.Filter = "Code = '" & ClA & "'"

'
'
End Sub

in form load: Combo1.Visible = False

my problem is: by clicking Command1, combo1 becomes visible true , but VB go directly to the next line of the code without waiting to select a value from combo1 to put in CLA as shown above...

I need your help to show me how to make combo1 stop and WAIT until i select a value then complete the code ...

Thanks
Ray
0
Comment
Question by:ray14
[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
4 Comments
 
LVL 22

Expert Comment

by:cookre
ID: 7170590
1. Add a refresh:

Me.Combo1.Visible = True
Combo1.refresh
Combo1.setfocus

then harvest the value from Combo1_LostFocus()
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 300 total points
ID: 7170617
Welcome to event driven programming, ray14.  Your problem is that you are trying to do too much in the click event of the button.  You could use the Combo click event to trap the result from the combobox instead:

Private Sub Command1_Click()
Dim CLA as string

Me.Combo1.Visible = True

'
'
End Sub

Private Sub Combo1_Click()
  Dim CLA as string

  ClA = Me.Combo1.Text
  Me.Adodc1.Recordset.Filter = "Code = '" & ClA & "'"

End Sub

If you allow people to type in the combo box, you might want to trap the Change event as well.
0
 

Author Comment

by:ray14
ID: 7170629
Hi Cookre,

Thank you for replying. But I still have the same problem. may you give me more help !!!

ray
0
 

Author Comment

by:ray14
ID: 7170664
Hi PaulHews,

thank you for your excellent help and expert note

Ray14
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

650 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