?
Solved

Clearing information from a form

Posted on 2014-02-18
8
Medium Priority
?
267 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
[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
  • 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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

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 2000 total points
ID: 39887656
0
 

Author Closing Comment

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

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

800 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