Display Prevoius Selections In Listbox When Editing Records
Jun 12, 2006
I have two unbound multi-select listboxes that saves selection to their respective table. It works just dandy. However, whenever I go back to the same record, the listbox is blank and apparently I have to instruct it to "retrieve" the previous selection from the table using the PK as criteria.
This is far as I can get, though this code causes several errors and I'm not sure what I need to put in as an array for "For Each" statement. If anyone can guide me how to retrieve the old selection from the table and displaying on listbox, that would be great.
If IsNull(DLookup("[ClientID]", "[tblClientAccommodations]", "[ClientID]=" & Me.ClientID)) = False Then
Dim RecCount As Integer
Dim Index As Variant
RecCount = DCount("[ClientID]", "[tblClientAccommodations]", "[ClientID]=" & Me.ClientID)
For Each Index In Me.lstReasAcc
Me.lstReasAcc.Selected = (DLookup("CommunicationID", "[tblClientAccommodations]", "[ClientID]=" & Me.ClientID))
Next i
Thanks in advance.
View Replies
ADVERTISEMENT
May 6, 2015
I have a training matrix that lists employee names and certifications on various operations. The objective is to choose an operation and run a query to display everyone who is certified on that op. There are additional variables.
Code:
Name EMP ID OP1 OP2 OP3 OP4 OP5
-----------------------------------------------------------------------------
John Doe 526261 C C C
Bob Doe 555622 C C C
Sheila Doe 066600 C C C
Okay that looks about right for the data itself. The listbox has all the ops, you choose an op and hit a button and it goes and finds everyone who has a 'C' in that op column and pulls their record.
View 14 Replies
View Related
Aug 5, 2005
I am using a SQL statement as the rowsource of a listbox. the expected result should be a list of 452 items which I verified by pasting the SQL statement into the Access query design and running the query directly. For some reason, in most cases, the listbox will only display 21 records. Other times it may display more than that (with the same SQL statement). What's really unusual is when I click on the form's "Find" button after the first set of 21 lines appears: it will then append more records to the list. Sometimes by doing this I can display all 452 records. The results seem to be somewhat random. I've tried adding delay loops, DoEvent statements, multiple requeries, repaint, etc. -- nothing I've tried seems to help. Any ideas?
View 3 Replies
View Related
Jun 5, 2014
I designed a simple form that has a listbox and a subform. I am using Northwind database for testing.
I would like to be able to display on a subform only records based on a value of a list box.
I created a listbox using a wizard and selected an option 'find a record on my form based on the value I selected in my list box'. This kind of works but it does not display all records matching criteria.
Attached print screen 1 shows my table and there are six records for 'Las Vegas' but my sub-form displays only three for Karen Toh (print screen 2) and all records for John Edwards are missing. I am not really sure how to fix this problem.
Ideally I would like to take this a step further and do another list box with Last Name and then filter data even further down so for example if I select Last Vegas and Edwards then the form would show me only matching records.
View 3 Replies
View Related
Jul 11, 2006
I have a listbox with about 8 different choices. i want to be able to query what is selected in this list box but I need to be able to select more than one choice so that my employees don't have to create multiple forms for the same item. Is there any way to select more than one option? It would help greatly even if I have to add code in VB I will figure out how to do it, thank you.
View 2 Replies
View Related
Apr 12, 2006
This must be pretty common but I cann't figure it out.
There is a listbox that multiple selections are allowed. This listbox is bounded with a table field. All selections must be stored. I don't mind if each selection is stored as a different record.
Any ideas?
View 13 Replies
View Related
Apr 13, 2005
Hi guys new here.
Here's what I'm trying to do:
I made a listbox in which get's it's source from a field in a table named Soft. The field is named Software1.
This field contains a list off software that could be installed on systems.
I allready can select multiple selections from the listbox but what I want to do is the following.
I want to press a button, and after I press the button I want that the selected Software is added to a new listbox which show the Software installed. The software in the second listbox would also be stored inside a Table so that I could print them out in Reports.
To simply explain what I'm trying to do:
SoftwareListbox >> Make multple selections>>Press button>> Adds selected software to InstalledListbox which stores in the softwarelist installed in a Table.
I really hope you guys understand what I'm trying to do.
And sorry for my bad english, should have paid better attention during English class ;)
View 11 Replies
View Related
Aug 29, 2005
Hi,
I have a simple order entry system working with a subform containing combo box where a client selects various products from a table. These are recorded in separate table which allows for subsequent updating of the orders placed.
Now I want to refine this so that the user may make multiple selections as it is a bit laborious making 'n' single selections via a combo based subform.
Only a list box allows multiple selections but I would like some guidance on how to store and be able to recall and update the selected items.
Thanks and Regards
Tony Randell
View 1 Replies
View Related
Dec 23, 2004
Hi,
I have a listbox from where i can make selections and generate a report for the selected values , the problem is the selections are limited to 28 selections, if i try to select even one more after that i get an error:
" Run time error '7769' "
" The filter operation was cancelled. The filter would be too long."
Now is there anyway to make this limited selection changed to a higher value or unlimited??? so i can select as much choices as i can , even all of them if i want? Does anyone have an idea , i looked throught the properties of the listbox but no help.
thankx,
solig
View 2 Replies
View Related
Aug 24, 2006
I have a form that has names with a subform with information. The contacts are in a list box and the subform (in datasheet view) shows the phone number/email/etc.. of the selected contact person. I am using the form as a quick look up of a persons information. Before changing it to a list box, it was previously a combo box, and everything worked fine. i was able to requery the subform and the cooresponding info for the person would come up. However, its now a list box and i am having problems with the code to make this happen. I have a different button sending the names selected from the list box to a report...and that works fine, but i am obvisouly missing something to make it work with the subfrm requery. Below is the code i got so far. Any help would greatly be appreciated. its driving me nuts!
Private Sub QuickLookup_Click()
Dim varItem As Variant
Dim strWhere As String
strWhere = "[memberID] = "
For Each varItem In Me.MemberID.ItemsSelected
strWhere = strWhere & Me.MemberID.ItemData(varItem) & " OR [memberID] = "
Next varItem
strWhere = Left(strWhere, Len(strWhere) - 17)
DoCmd.Requery "subfrmqryindividual"
View 2 Replies
View Related
Sep 21, 2005
Using Access 2003.
I will have a ListBox on the form with “Multi Select” set to either simple or extended. I have a collection of documents which must be recorded in a database. Some documents may have only one author, but could have more. Same with the recipient or copied-to.
Ideally it would be nice to have the ListBox on the left, selected one or more from the list and then pass them to one of the three fields by a command button, sort of like:
cmdAuthorAuthor1
LISTBOXcmdRecipientsRecipient1; Recipient2
cmdCopiedTo Copy1; Copy2; Copy3
I would like to have all of the names selected from the ListBox as a string, but fully understand the problems associated with normalization. Other posts have suggested subforms. So, the question is how to select from the ListBox and then pass the possible multiple selections to discrete fields on a subform that would display, say three fields and which would get away from the normalization issues:
cmdAuthor [Author1] [ ] [ ]
LISTBOXcmdRecipients [Recipient1] [Recipient2] [ ]
cmdCopiedTo [Copy1] [Copy2] [Copy3]
The secondary issue will be that there will be subsequent names which are not found until actually in the process of document review which will create a need to update the ListBox, which I know is not akin to a ComboBox NotInList function.
If there are any thoughts or coding out there which will help, it’d be appreciated.
Lawguy
View 1 Replies
View Related
Feb 18, 2015
I am trying to get my VBA to filter the subform, as currently it does nothing! I have copied it from a source on another forum and at the end of the VBA it originally opened up the query.
However I am trying to tailor this query so that instead of it opening the query I can have a datasheet on the form that displays the filtered records..
There are 3 multiselect listboxes
Here is my code
' This code uses ADO and ADOX and is suitable for Access 2000 (and later).
' A reference must be set to Microsoft ADO Ext. 2.7 for DDL and Security.
Private Sub cmdOK_Click()
Dim cat As New ADOX.Catalog
Dim cmd As New ADODB.Command
Dim qry As ADOX.View
[Code] ....
View 5 Replies
View Related
Aug 20, 2013
I want to be able to edit an unbound listbox. The box consists of two cloumn, PersonsName and NoOfDogs. The PesonsName is would be edited from the Contacts form if it needed editing, which is fine as would the number of dogs that they owned. The listbox is on a form that shows how many people are going to an event and how many dogs each person is bringing with them (not always the amount that they own).
When the person says that they are attending an event they may not, at that point know how many dogs they are bringing so the user would update that information later. The easiest place to be able to do that is by editing that coloumn in the listbox. I understand that this means editing the table that feeds that listbox which is fine.
I just want to simply be able to click on the name in the listbox and edit the No Of Dogs for that person.
View 4 Replies
View Related
Jan 29, 2014
I have a listbox which is populated by a query from a table.
I also have a sub which allows users to quickly select multiple items from the listbox (based on a pre-defined criteria) rather than scrolling through and selecting them manually / individually
The sub works fine but when it is finished, the listbox is automatically scrolled to the bottom (or, rather, to the last selected item)
I would like to have the listbox scroll back to the very top once all of the appropriate items have been selected.
(I could loop through the listbox items in reverse - or 'bottom-up' - in the code but that would only have the desired effect if the topmost item was selected. I want it scrolled to the top regardless of whether the topmost item is selected or not).
View 2 Replies
View Related
Jun 5, 2015
I have a form that has 3 combo boxes and a text box that I want to be a lookup. I have a little experience with DLookUp, but I do not think that will work here. The three combo boxes are linked to queries, and Tables. The first combo box is for choosing "Precious" or "Base" metals. The second combo box is filtered from the first and displays the "Metal Names". The third combo box is to choose a "Metal Market". There are currently four options for that. I want the text box to display the "Metal Market Price" based on the second and third combo box selections.
Here is a screenshot of the table with all of the metals and their market prices filled in with dummy values for now:
metals screenshot 1.PNG
Metals screenshot 2.PNG
Here is a screenshot of the relevant Form: Metals form screenshot.PNG
Here is a screenshot of the Table that relates to the relevant form: Metals table design.PNG
Here is a screenshot of the Metal Market table that the Query is based on: Metal Market Table.PNG
View 14 Replies
View Related
Apr 1, 2013
I am trying to create a Delete query.
I am trying to delete a specific part from multiple BOMs in my database.
I have a table of the BOMs that I want to look in. I called this table PartTable. I also linked my database table SYSADM.REQUIREMENT which contains all the requirement parts for all of our BOMs.
So I am wanting to delete only part number 123XX from each of the BOMs in my PartTable.
I am able to select the records with:
Code:
SELECT SYSADM_REQUIREMENT.*
FROM SYSADM_REQUIREMENT INNER JOIN PartTable ON SYSADM_REQUIREMENT.WORKORDER_BASE_ID = PartTable.PART_ID
WHERE (((SYSADM_REQUIREMENT.WORKORDER_TYPE)="M") AND ((SYSADM_REQUIREMENT.WORKORDER_BASE_ID)=[PartTable].[PART_ID]) AND ((SYSADM_REQUIREMENT.WORKORDER_LOT_ID)="0") AND ((SYSADM_REQUIREMENT.PART_ID)="123XX"));
Now how do I delete these same records.
I am getting error saying I have to select a table to delete from....
View 11 Replies
View Related
Apr 12, 2014
Using Access 2007. I have a form (Broker), with a combobox (cboClassifier), that I use to select 1 of 4 phrases, display the selected phrase and color the field with a color that I've assigned to each phrase.
Next, I have a report that contains all of the Broker names, addresses, etc. based on a query (qryBroker). I need the vba or whatever that colors the matching records based on the phrase selected by the combobox on the form, when the report is opened.
View 1 Replies
View Related
Sep 4, 2005
Hi all
At the moment I have a form which links to a table, one of the columns in the table is called "Description" so the user can input a sentence or two. Basically I when I open this form (in Edit Mode as Im using a Switch Board)it will not allow me to edit a current record.
I can edit a record in the tabel but not in the form.... :eek: .. help
Any help would be superb
Cheers
View 2 Replies
View Related
Oct 24, 2005
Hi everybody,
I have a large problem which I can't figure out (well 2 actually but the other is less important):
1) I have a form which brings up the results of a search performed by the user (only contains some fields). From this list of results i would like the user to be able to a) see a full report of that Record (which I've done ok) and b) edit the data contained in that Record.
My results form opens the editing form no problems, however, i cannot edit any of the data contained within it. This only occurs when the results form is open as well so i guess it's because there are two instances of those fields open simultaneously. However, I am reluctant to close the results form because the results will be lost.
2) I've tried several methods to open the form at the desired record:
- using the WHERE condition argument of the OpenForm function
- creating a filter in the editing form that runs in the OnOpen event
These two require the creation of a variable (I'm using the Key field) that is inserted into these bits of code. However, all of my attempts thus far have been unsuccessful; every time it asks for the Parameter in a popup. I've defined the variable as a Public variable in a seperate module but don't really understand this aspect partcularly well; I'm obviously missing something.
- the form currently opens from it's own query that gets the Key Field Criteria form a hidden control on the results form.
Here is my code for the 'Edit' button:
Public stProjectID As String
'Results form 'Edit' button click:
Private Sub btnEdit_Click()
stProjectID = txtID2
[Forms]![frmResults].Visible = False
DoCmd.OpenForm "frmProjectEdit", acNormal
End Sub
'Edit' form open:
Private Sub Form_Open(Cancel As Integer)
Me.Filter = "ProjectID = stProjectID"
FilterOn = True
End Sub
Sorry for waffling on...
Thanks in advance for your help.
Bobadopolis
View 2 Replies
View Related
Oct 25, 2005
I have a very simple form that is populating fields with records from a number of tables (not queries).
I have found that I cannot edit any of the records from the form. Almost all of these fields are NOT key fields. When I click in the field, it simply selects the text in the field, but does not allow me to alter it (typing does nothing...the cursor just blinks). The same thing happens for blank fields.
I know this is a simple question, but I can't find the answer in help or searching this forum. I know it must be a simple setting (I think) somewhere but I've tried a number of settings in properties/forms.
Thanks,
Kelly
View 9 Replies
View Related
Jul 6, 2006
Hey guys,
Does anyone have any ideas as to how you might go about editing multiple records at once? So maybe have a listbox with checkboxes, so you can select items in your DB, then, using a form, edit/set one field for all the selected items. Any ideas?
View 4 Replies
View Related
Nov 3, 2014
I have a query that selects the "Active" records for three different selections, A, B or C.. There may be 1, 2 or 3 results for a particular selection. That is Selection A may have one result or active records, but Selection B may have three results.
I want to use data from the query to populate a field on a form. For example, if the results for Selection A, having one "Active" record would be RecordAData. But for Selection B with three "Active" records the result would be RecordBData & " " & RecordBData2 & " " & RecordBData3
My query is:
SELECT tblSomething.ID, tblSomething.D1, tblSomething.D2, tblSomething.D3, tblSomething.D4, tblSomething.D5, tblSomething.D6, [D3] & " " & [D4] & " " & [D5] & "-" & [D6] & " " & "SomeText" AS Header
FROM tblSomething
WHERE (((tblSomething.D1)=Forms!frmSomethingHeaders!D1) And ((tblSomething.D2)=True));
The concatenation in the query is labeled "Header". I want to be able to Concatenate the "Header" which in itself is a concatenation in the query.
I thought that this might be a looping through the query results, but I cannot figure out how to do it. But then, that is only my uneducated guess.
View 11 Replies
View Related
Jan 30, 2015
How to correct the issue below. I created a split form and I have 2 combo boxes that allow multiple selections. The one combo box for LOB (line of business) works perfect and does not create duplicate records in the datasheet view of the split form. The 2nd combo box with multiple selections creates duplicate records in the datasheet depending on how many selections are made.
I have checked this in the underlying table and there are no duplicate records, it is only in the split form datasheet. I have checked settings and configuration between the 2 combo boxes that are reacting differently and they appear to be identical...
View 7 Replies
View Related
May 22, 2007
Hello all,
I have a question, I'm building a MS ACCESS database and within it i have a table for putting in my program critical parameters. I don't want anyone to change the content of that table. That means not editing the 1 record in it and not adding a new record. Within the program is't a problem but if you make an other blanc database you can import the table, change it and export it back into the program (i know it is far looking but it happens).
How can i lock a table so it cannot change or it cannot be exported or imported???
View 2 Replies
View Related
May 8, 2005
Hey guys..
is there any way in which i can prevent the user operating a form from adding or deleting or editing any records ?
View 10 Replies
View Related
Aug 13, 2014
Just a general query about the best approach to take for an editing form.
I want to have two separate forms, one for adding a new record (have completed this) and one for choosing and then editing a selected record.
I have seen that people use combo boxes to display a list of records with fields. This seems quite difficult to use. Maybe that's the best way though?
How do you apply an edit button to a selected record in this type of situation? I suppose really I need a box that has a list of records with a little edit button next to each one, or can I do something that launches the edit form as soon as you click on a specific record?
View 2 Replies
View Related