I'm using access 2003, and for some stupid reason they decided to remove the "clear" method from listboxes... In previous access version I could clear a listbox using "listbox.clear", but now I have no idea. Does anyone know a good way to clear listboxes in Access 2003.
I have a multiSelect Listbox that has email recipients. I have a command button with Me.emaillist = Null, and after I click the command button the Listbox is still highlighted in black. What VBA command do I create to completely clear the multiSelect Listbox, including the highlighted selection?
I have populated a list box with records using 3 columns. now I want to clear the list box Me!Listproperty.Value = "" does not do it what code should i use ?
I have a multi select listbox that I rebuild as I index thru some products in another listbox. This listbox then gives me the ingredients I can use. Works well, but the ghost selections in the listbox stay hilighted even after the rebuild.
I can select and de-select at will if there are actual items in the list box, but the ghosts remain.
Here is the code to clear the listbox
Dim _ ctlSource As Control, _ varSelected As Variant, _ intListCount As Integer Set ctlSource = Forms.frm_select_UPC_LoinGrade!lstBox_ColdStorage For intListCount = 0 To ctlSource.ListCount ctlSource.Selected(intListCount) = False Next intListCount Forms.frm_select_UPC_LoinGrade.Refresh Forms.frm_select_UPC_LoinGrade.Repaint
Hi, I'm new here, so I hope I'm posting this in the correct place. I've searched the forum to see if there are any existing threads that might help me, but I've not found anything that does... (I think this thread ( http://www.access-programmers.co.uk/forums/showthread.php?t=93444&highlight=Copying+data )may be trying to achieve something similar to me, but I'm a beginner and don't really understand it)
I shall stop waffling! I'm not entirely sure that what I'm trying to achieve is possible, I expect it probably is!
Right, I have a form (frmGroupRegister, which contains exactly the same fields as the table it comes from, tblGroupRegister), which consists of three things:
-GroupDate - The date a group took place on. It is my primary key, as no more than one group occurs on a specific date.
-ParentList (A listbox which contains a query showing the ID number, forename and surname of everyone in a table, tblParentDetails)
-ParentsAttending (A blank listbox)
I would like to place buttons in between the ParentList and ParentsAttending, which would allow users to conduct a 'register' of attendance by copying individual/multiple details from ParentList into ParentsAttending (much like you get when choosing which fields to include in a form when using a wizard for example). I would also like them to be able to remove people from ParentsAttending by using a button in case of accidentally adding the wrong person into the ParentsAttending box.
I'm aware that another, probably simpler way of achieving this would be to use a tick-box system, but I feel that visually, the first method would both look better and demonstrate who is present more clearly.
Any help would be much appreciated, but my Access skills are quite basic and things will probably need to be spelled out for me. I'm using Access 2000 and Windows XP. Thanks for your help, Alice :)
I am using the selections made of the form to generate a query for the user.
I have a CITIES listbox that is populated with values from a stored query.
I would like to make it multi-select and populate a LOCATIONS list box and a NAMES list box based upon the CITIES that are selected.
I have the locations currently populated from a stored query that reads the City selection from the Form. It looks like this
Code:
SELECT DISTINCT (t_location.LOCATION) AS Expr1 FROM t_location INNER JOIN t_asset_master ON t_location.LOCATION_PHY_ID = t_asset_master.LOCATION WHERE (((t_location.CITY)=[Forms]![MasterQueryGenerator]![CityList]));
I also want multi-select so that is you can un-select all and get the results for all cities.
Here is my half thought approach.
Code:
Private Sub CityList_AfterUpdate() 'Dim LocQryStr As String 'Dim r As Integer 'Dim ctl9 As Control 'LocQryStr = "SELECT DISTINCT (t_location.LOCATION) " & _
[Code] ...
I intended to have the variable LocQryStr as the row source but I abandoned the idea of having multi-select when I saw that .Selected(I) never returned true. Its like the values aren't read in this subroutine.
I have a list box called "product list box" based on a query called "searchqry", i also have another listbox called "type list box" , how do i get the type list box to only show "types" based on the section in products list box?
1. On my main form, I have a listbox, I would like to edit the values of the listbox.
To do this, I have a popup form with 2 listboxes, one to have the values of the listbox on the main form, and the other listbox with option values for the 1st
1) how to i pass the rowsource sql of the listbox on the main form to the listbox on the popup form
2) how on closing the popup form, do i update the rowsource sql listbox on the main form from the changed value of the popup form listbox rowsource sql
Okay then, after much trouble and confusion, I finally realized I need to use an Extended listbox in order to allow for multiple items to be selected from a list on my form (rather than the evil multiple selection combobox!).
However, now I am trying to figure out how to make one listbox (IndustryClassification) only be visible if the item "Industry" is selected in another listbox (TypeOfBusiness). Coding I can use for this in the AfterUpdate event of the listbox?
I've got this multiple select listbox which writes data into a textbox:
Private Sub List2_AfterUpdate()
Dim Cursisten As String Dim ctl As Control Dim Itm As Variant
Set ctl = Me.List2
For Each Itm In ctl.ItemsSelected If Len(Cursisten) = 0 Then Cursisten = ctl.ItemData(Itm) Else Cursisten = Cursisten & "," & ctl.ItemData(Itm) End If Next Itm Me.txtCursisten = Cursisten
End Sub
And I've got a SELECT ALL button to select all records in the listbox:
Private Sub cmdSelectAll_Click() On Error GoTo Err_cmdSelectAll_Click
Dim i As Integer
If cmdSelectAll.Caption = "Alles Selecteren" Then For i = 0 To Me.List2.ListCount Me.List2.Selected(i) = True Next i cmdSelectAll.Caption = "Alles De-Selecteren" Else For i = 0 To Me.List2.ListCount Me.List2.Selected(i) = False Next i cmdSelectAll.Caption = "Alles Selecteren"
The only thing is that when I use the SELECT ALL button, the function List2_Afterupdate doesn't work anymore. There must be a simple solution but I just can't figure it out. Can anyone please help me?
Hopefully somebody can help me on this one. I searched the whole internet and access forums, but I didn't find the exact solution for my problem.
I've got a table with students, a table attendance, where I now only save the students who are absent, but I would like to save also the students who are PRESENT (at the same time). I've got a combobox where I filter the Class, which then updates a listbox with the students from that class. What I do now is select the students from the listbox and then press a save button and it saves the records to the table absence with STATUS: ABSENT.
I would like to save the NON selected students also in that table, but with PRESENT in the column STATUS.
I thought of making another listbox next to it, where after selecting the absent students, they wil apear and disappear in the PRESENT table so I can store all the information. But the only problem is that I can find this solution when the listbox is populated by a list of values instead by a table or query. And the other solution is to store the temporary data into 2 different tables, but that's not working for me because it's a multi user database and everything will be messed up.
Hope that someone can help me, I will be very happy.
Firstly, is it possible to hide unchecked values in a listbox? I have a user with several roles and I want to only show the ticked roles in the listbox.
Secondly, can you create a hyperlink on listbox values? i.e, if I click on "Manager" in the roles listbox, it follows that to another form and opens the record about managers?
what's the best way of clearing the contents of a combo box? i don't want to change the row source, just make it blank as though a selection has not been made.
i have two unrelated combo boxes on a form; there will probably be more later. when i pick a value from one i want the other(s) to clear.
on the after update event of each combo i've tried clearing the contents of the other combo with these:
'= null' clears the other combo. '= 0' also clears the other combo.
but i think i'm missing something here. each combo also has a cmdbutton that will take the user to another form based on the selection made.
if i use '= 0', the other combo clears but its cmdbutton still works. even if the combo appears to be empty its associated cmdbutton still opens the next form (it should produce a msgbox asking the user to make a selection).
'= null' clears the combo and its cmdbutton produces the appropriate message to make a selection. so that's what i'm using right now. is this the best way? can something = null?
I need to b able to clear records from 3 tables with one click
I tried opening each as a record set and looping through deleting each in turn with a loop, however this I know to be poor practice and it also errors as i cannot delete a record that is part of a relationship.
I have a table setup to enter dates for each person that requires safety quizes for the month those that don't have an "N/A" for the month by thier names.
Each year I have to start over and it is a real pain to manualy delete all the dates for each person for Jan through December. I only want the dates gone not the name or the N/A values.
Is there a sub or query that will search each record and only delete the dates?
I have some code that looks like this to control a form;
Private Sub btnAdd_Click() Dim UserName As String Dim Initials As String Dim Password As String Dim OutlookName As String Dim rst As DAO.Recordset
'Check each control, is their a value? if not, set focus to control If IsNull(txtUserName) Then MsgBox "You did not enter a new UserName nobby!" Me!txtUserName.SetFocus Exit Sub
ElseIf IsNull(txtInitials) Then ' return value of UserName variable; MsgBox "You have not entered any initials for user: '" & Me!txtUserName & "'" Me!txtInitials.SetFocus Exit Sub
ElseIf IsNull(txtPassword) Then MsgBox "You must create a password for user: '" & Me!txtUserName & "'" Me!txtPassword.SetFocus Exit Sub
ElseIf IsNull(txtOutlookName) Then MsgBox "You must enter a Outlook name for: '" & Me!txtUserName & "'" Me!txtOutlookName.SetFocus Exit Sub
End If ' Pass the variables to the table. Set rst = CurrentDb.OpenRecordset(("Users"), dbOpenDynaset, [dbSeeChanges]) With rst .AddNew ![User] = Me!txtUserName ![Password] = Me!txtPassword ![Initials] = Me!txtInitials ![OutlookName] = Me!txtOutlookName ![Level] = 1 ![Select] = 0 ![dummy] = Null .Update .Close Set rst = Nothing End With DoCmd.Close End Sub
Private Sub btnCancel_Click() ' Confirm Cancellation Box If MsgBox("Are you sure you want to quit?", vbYesNo, "Caution") = vbYes Then DoCmd.Close Else DoCmd.CancelEvent End If
End Sub
What I really want to do is once the update has occured is set a label I have as hidden, to show and to clear all the controls.
Thanks, Now I can populate text fields by selecting any one of the combo box selection.
But I need to clear the form to insert next record. Currently I am inserting record by using Save_cmd button. I can insert second record but couldnot clear all the fields after inserting automatically. So I am doing clear all the fields manually or overwriting values.
I have a part of the form with the following fields
Title Name Address1 Address2 Area ...
Address2(street) field is a drop downbox, once selected the area text field will be automatically shown what I got in AfterUpdate event on Street is as below Me.txtArea = [cboAddress2].[Column](2)
the problem with this is, even when I move to another record the Area field doesn't clear up which is still using the old Area info that has been selected before,
I belive I have to have some Clear Up function on somewhere, not sure exactly where and what Code will clear up the value,
I have a SQL Database that is housing my tables I have an Access Front end that is Allowing users to view and edit the data residing on the SQL Database.
I have write/modify rights on the database and as such I wrote the code , OnLoad of Form, to Automatically set the Form to "Add Record", thus clearing all the TextBoxes and ComboBoxes. That works alright.
My problem is when a user without write/modify rights opens the Form I am getting an Error "Cannot go to specified Record". If I understand this right this is happening because they do not have suffeciant rights.
How Can I get a form to load and display all the textboxes and ComboBoxes BLANK....this only way I can think of is to set the form to Add Record.
How do I clear a filter ? When I re-open a form that is based on a stored parameter query, I get a message about "apply/filter that cannot be applied..."
So, as a result, I put in some code for that command button that closes the form, then reopens it, and I get my prompt from the query. Isnt there a way to clear the filter without closing the form? It looks funny to me and I know the users will have a cow. I sure appreciate any ideas.Im digging around to see what I can do quickly, but I cant find anything that works. thanks a lot!
Private sub Form_DatasetChange() Text28.Text.Clear End Sub
I am wanting to move between records but when I return to the records I have just moved from I want to clear some of the text boxes. This code is not working though. Any suggestions
I have a transfertext macro that imports my text file into a table but the table already has data in it so it is not importing and losing all the records. What do i do to clear out the table before i import in.. Can i use another macro ???