Solved

Clearing information from a form

Posted on 2014-02-18
8
264 Views
Last Modified: 2014-02-25
I have a piece of code that I am using to clear information out of three combo boxes and a list box when I click a button. The problem I am running into is that, after I click on the button, the list box clears but won't repopulate when I refresh the screen.

I suspect it might have to do with my not using Null in the formula, but when I do use Null I get errors.

Here is the code:

Private Sub btnAssign_Click()
Dim ctl As Control
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acComboBox
If ctl.ControlSource = "" Then
   ctl = ""
End If

Case acListBox

ctl.RowSource = ""

Case Else
End Select
Next ctl

End Sub

Open in new window


Any and all help is appretiated!
0
Comment
Question by:Megin
  • 4
  • 4
8 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39869085
<the list box clears but won't repopulate when I refresh the screen. >

the reason is,
you removed the Rowsource of the listbox on this line


ctl.RowSource = ""


if you want to clear the listbox, just use

ctl=""

if that does not work, post back with the properties of the listbox, multi select ? rowSource , bound column ?
0
 

Author Comment

by:Megin
ID: 39869091
Now when I click on the button it clears everything but the list box.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39869095
is that all you can post?
0
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.

 

Author Comment

by:Megin
ID: 39869099
Here is the whole database. The form I am programing is frmAssignStaff.
For-Use-on-Utter-Access.accdb
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39869119
0
 

Author Comment

by:Megin
ID: 39887606
This for is still not working correctly.

One  the first entry it works fine. Then I click on Assign New Staff Member. At that point everything clears except the list of names. I want the entire list to be clear.
Then, when I try to pick a new task order, I get this warning:

"This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numberic expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables"

Also, Ray, I am sorry I didn't get back to you sooner. When I saw the uploaded database I assumed it was the one I had uploaded and not a response.  Thank you for your assistance!
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39887656
0
 

Author Closing Comment

by:Megin
ID: 39887699
I appears to be working perfectly now. Thank you!!!!
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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 …

790 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