[Last Call] Learn how to a build a cloud-first strategyRegister Now


clear listbox after add data to table

Posted on 2011-04-24
Medium Priority
Last Modified: 2012-05-11
In this example i had help with-
is there anyway to have listbox cleared after command button clicked and data added to table.
if you close form and open back up - items still there
thank you
Question by:davetough
  • 3
LVL 75
ID: 35456680
Well, you can do this:

Private Sub Form_Load()
    Me.List12.RowSource = ""
End Sub

But ... how would plan on putting it back ?

LVL 75
ID: 35456686
In other words, when do you want the list items to appear?

LVL 120

Accepted Solution

Rey Obrero (Capricorn1) earned 1000 total points
ID: 35456691
use this codes

Private Sub Command14_Click()
DoCmd.SetWarnings (False)
For i = List12.ListCount - 1 To 0 Step -1
DoCmd.RunSQL ("insert into tbl1(serialNumber) values('" & List12.ItemData(0) & "')")
List12.RemoveItem (i)
Next i
DoCmd.SetWarnings (True)
End Sub

LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 1000 total points
ID: 35456704
I guess you could do this - see command button


Author Closing Comment

ID: 35457406
both solutions seem to be working- thank you

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

830 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