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?
i've got a report which pulls its data from a query. it pulls these fields:TestCode...Price...HID...Month...etc . . .
There are names of "TestCode" that we don't want to display, is there a way to filter certain "TestCodes" out? if so, how?
Here's my current SQL Code: I have a query which pulls certain records from a table, here is my SQL statement: SELECT [qryGroupByAMCount].[TestCode], [qryGroupByAMCount].[Price], [qryGroupByAMCount].[HID], [qryGroupByAMCount].[Month], [qryGroupByAMCount].[CountOfAutoNumber], IIf([TESTCODE]="PTCGCD",[CountOfAutonumber]*2,IIf([TESTCODE]="LSHABC",[CountofAutonumber]*4,IIf([TESTCODE]="HPVPNL",[CountOfAutonumber]*2,IIf([TESTCODE]="TOXOAB",[CountofAutonumber]*2,[CountofAutonumber])))) AS Extended FROM qryGroupByAMCount
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 iThanks in advance.
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.
I have a table with approximately 700 records. This table consists of a location field. I want a user to be able to select a location from this table via a form. Listboxes and Combo Boxes hold 255 rows. Plus, what user would want to use one of those to search through to find the location they are looking for. Any body have any ideas on a better way to do this? They have to stick to the list, otherwise I would just have a text box for them to type in.
Only just started happening, with no explaination! Only one subform out of 5 shows as just background space until a choice is made from a combo box and then the thing appears with the record. WHY?!?!?! I HATE ACCESS... It's rubbish!! Apologies for my outburst...
I have a database that I have created for work. On the form I have several dlookups running. A couple of them show up as expected. But most of them are showing up blank. That is until you click on the box, then the result appears. Changing the Locked and Enabled settings does not resolve this.I have the database locked up for normal users. When I access it by holding shift while opening, when I access this form, the dlookups all show the desired results. No clicking on the boxes required.
I've tried refreshing, but that doesn't work. If I write code that loops through all of the textbox controls, setting focus on them and moving throuhg the form, then the results will show up. Basically having VBA click on the boxes for me. Although this works, there is a slight lag and screen flicker as it sets focus to all of these textboxes.
In a form used to record a sale for a company we have a dropdown box with the contact names for that company and when one is selected it populates other boxes like phone number etc however the combobox brings up all possible contacts but when some of them are selected all the boxes return blank, including the combobox, whereas most of the contacts work fine.
The SQL used for the combobox is as follows..
Code: SELECT tbl_Contacts.ContactTelephone, tbl_Contacts.ContactMobile, tbl_Contacts.ContactEmail, tbl_Contacts.ID_Contact, tbl_Contacts.ID_Company, tbl_Contacts.Salutation & " " & tbl_Contacts.ContactForename & " " & tbl_Contacts.ContactSurname AS MainContact FROM tbl_Contacts WHERE (((tbl_Contacts.ID_Company)=[tbl_CompanyBookings].[ID_Company])) ORDER BY tbl_Contacts.ContactForename;
On one of my Access2000 forms, I have the following sub that takes the user to a particular record whose value is passed to the sub as a variable. It frequently results in EOF being true because the recordset does NOT get all the records in it during rs=RecordsetClone. I set a msgbox to tell me the RecordCount, and even though there are almost 3000 records in the underlying table, the rs.RecordCount was anywhere between 300-750 each time I ran the code. Therefore, rs.find won't find the right record most of the time, because that record won't be in the recordset. What causes this and how can I fix it?
Here's the code -- I've got MoveLast and MoveFirst both in there to help ensure that all the records get grabbed, but that had no effect; I still get EOF:
***************************** Public Sub GotoOrder(pOrdID As Long) On Error GoTo Err_GotoOrder
Dim rs As ADODB.Recordset Set rs = Me.RecordsetClone
I have been working on this problem for 3 days, and can't figure out what to do. I'm using Access 2010.
I have two tables. Tier1 and Tier2.
Table: Tier1 has Tier1ID (autonumber) and Tier1Desc
Table: Tier2 has -Tier2id (autonumber) -Tier1ID (which is the link back to the Tier1 table), -Tier2Num -- this number shows which tier2 records are associated with each other - and about 6 fields with descriptive info, 2 of which are memo fields
I have a form that has 2 listboxes:
- Listbox 1 has the row source to Tier1 table, control source Tier1ID - Listbox 2 is an unbound listbox with the row source to a query.
The query is all the fields from Tier2 with the criteria where Tier1ID in Tier2 table = Tier1ID in Tier1 table
This all works. When I select something from the Tier1 ListBox, it displays the associated tier2 items for the tier1 selection.
What I need : When the selection is made in the 2nd listbox, I need the other 6 fields in tier2 table to be displayed based on the "Tier2Num". The listbox does return Tier2Num correctly.
I just need to display all the rest of the fields.
- I tried a popup form based on a query, but can't seem to pass the tier2Num to a form. (The query works if you enter the Tier2Num, which is the [listitem] selection) - I tried dlookup in a textbox - I tried to add all the fields into the listbox, but could only get 3 to display (then I was going to do textboxes with the control(#) in it.
(this might be more appropriate in Forms; apologies if I'm putting it in the wrong place.)
My company runs a home repair program and we keep track of our clients in a database I made a few months ago. We use almost exclusively a form drawing from 3 tables. We just hit 800 records (according to the form) and I was checking some things, and found that there are 807 records in each of our 3 tables.
I did a preliminary check, and the primary keys match as best I can tell, so I'm trying to figure out how 7 records can be missing from our form.
:confused: :confused: :confused: Hello, I am new here to the forum.
I have a list box on a form that i want to display a list from a single cell or a table in my access database. The list in this cell is a list seperated by commas such as.....
Field 1 Field 2 example a, b, c, d
I want my listbox to display the list from the first cell in field 2.
Anybody have any ideas?
Thanks,
Kevin :)
PS I know something similar can be done in visual basic. For example, a simple program can be written to take a list (seperated by commas (,) ) and then display this list in a listbox on the form. Is there a way that the simple code such as that can be altered to work in access?
I currently have a listbox. (list32) that is populated with results of a query. I would like to doubleclick on an item and have it open a form that displays the listbox record i clicked on and a "notes" field. Its my understanding that the table fields are limited to 255 chars so i was curious if I could make the notes field reside somewhere else. I will need the notes able to be edited, specific to record entry, and then saved on exit. Is this doable?
I Have a table that contains the fields: CAT, CHAPTER, ID, someSrting and Completed
CAT, CHAPTER, ID are numbers and Completed is true/false. If I mark a certain entry as Complted (true), I want all the records with the same (CAT, CHAPTER, ID) as the one I marked to be updated to Completed.
For example, If I marked the entry cat:1 chapter:1 id:1 as completed (true), I want all the entrys that have cat:1 chapter:1 id:1 to be marked as completed (true)
the code I wrote is:
Code: Private Pub Completed_check_AfterUpdate() Dim myCC Dim myCat Dim myChap Dim myID myCC = Me.Completed_check myCat = Me.CAT myChap = Me.CHAPTER myID = Me.ID CurrentDb.Execute "Update [my Table] " _ & "SET Completed = (" & myCC & ") " _ & "WHERE CAT = (" & myCat & ") And CHAPTER = (" & myChap & ") And ID = (" & myID & ") ;" End Sub
I'm running the code (my clicking the "check box") and nothing happens, I was thinking that maybe I defined the after "WHERE" statement wrong, and there are 0 entrys changed..
UPDATE: after removing the
Code:
"& "WHERE..."
row, the code does update the entire table, so I have a problem with the syntax of the sql..
I am currently trying to make a form which will generate a report for the users. Currently the form has 3 combo boxes where users select which fields they want displayed from the table in the report. They also have sorting options next to them (Asc or Desc). I am now trying to put in a multi select list box under each combo box to allow users to filter the report to their liking. Currently I am trying to pull distinct values from the specific field of the table and display them in the listbox for users to select.
I have tried using vba to set me.filter1.rowsource = SELECT DISTINCT me.combo1 FROM EVAP_Database, but this doesnt seem to work. I have also tried a few other codes and still no luck.
I have an Access 2010 database that I have split. In the database I have a couple tables, forms and two reports. I have entered some data into one of the tables, but when I go to edit the data in the form the next time, there is no data (though I have verified that there is data in the table). Also, there are two reports that can pull the data without any problem.
My form has a listbox (lstHeatTreatments - Multi-Select disabled) that displays Heat Treatment descriptions and an unbound textbox (txtHTDetails) that I would like to have display the corresponding memo field when a description is selected from the listbox.
This is my code so far:
Code: Private Sub lstHeatTreatments_AfterUpdate() Dim myConnection As ADODB.Connection Dim myRecordSet As New ADODB.Recordset Dim mySQL As String Dim selectedRequirementKey As Long Set myConnection = CurrentProject.AccessConnection Set myRecordSet.ActiveConnection = myConnection
I have a form with a listbox on it and I am trying to make a button that will delete the selected records from a table. The List box is filled from a query. Any help would be very appreciated.
Table to delete records from = tbllinkPersonel_Training listbox = lstTraining_In
_______________________________________________ Private Sub cmdDelete_Click() Dim db As DAO.Database Dim rs As DAO.Recordset Dim var As Variant Set db = CurrentDb Set rs = db.OpenRecordset("tbllinkPersonel_Training")
If IsNull(Me.cboTraining) Then MsgBox "No Class selected...", vbExclamation Exit Sub End If
For Each var In Me.lstTraining_In.ItemsSelected With rs .Delete End With Next
MsgBox "Deleted Successfully...", vbInformation
rs.Close db.Close
Set rs = Nothing Set db = Nothing
Me.lstTraining_In.Requery Me.lstpersonel.Requery End Sub ____________________________________________
I have a form with a subform which has a listbox on it which lists all the letters sent home to a student. However despite the subform being linked by admission Number the list box is showing all records and not just the ones associated with the student.
I know this is going to be really obvious but please can someone tell me what is wrong?
Here's a tough one that has been driving me crazy! (Probably easy, but I don't want to admit it!)
I have a form with a listbox called "lst_exclist". The recordsource for this listbox is the following query:
SELECT tbl_collexcludereasons.priority, tbl_collexcludereasons.excname, IIf(tbl_collexcludereasons.enabled=-1,'Enabled','Disabled') AS enabled, tbl_collexcludereasons.priority FROM tbl_collexcludereasons ORDER BY IIf(tbl_collexcludereasons.enabled=-1,'Enabled','Disabled') DESC , tbl_collexcludereasons.priority;
Which basically gives me this with dummy data: 2 PIPELINE ENABLED 3 HELLO ENABLED 5 GOODBYE ENABLED 1 BAD DISABLED 4 GOOD DISABLED 6 LAST DISABLED
I had two command buttons, one up arrow and one down arrow. The up arrow is supposed to move the selected record on the listbox up by exchanging the next lesser priority number with itself. The down arrow does the same. The DISABLED records are supposed to be ignored on the move up and move down procedures, meaning only ENABLED records are allowed to exchange priority numbers, and thus move up or down on the list. I tried the following code:
Me!lst_exclisthidden = Me!lst_exclist
DoCmd.SetWarnings False
Dim startingnumber As Integer Dim endingnumber As Integer Dim nametochange As String Dim getchangerst As DAO.Recordset
If IsNull(Me!lst_exclist.Column(0)) = True Then MsgBox "Please choose an entry on the above list to move.", vbCritical, "Error" Exit Sub Else End If
If Me!lst_exclist.Column(2) = "Disabled" Then MsgBox "There is no need to move a disabled selection, please enable the selection to change it's priority.", vbCritical, "Error" Exit Sub Else End If
If Me!lst_exclisthidden = acLast Then MsgBox "You cannot move the bottom selection on the list down, please choose another one.", vbCritical, "Error" Exit Sub Else End If
But it seems to loop when it gets the the area it is checking for numbers because the highest records is disabled, so it's ignored. How can I make this work? Please help!
what is the best approach to get my listbox's values on a report. i have a form that has this listbox (the values in listbox can always change.. because the user has filter options.. to tell the listbox what records to display). this report will be run off of the same form (as the listbox is on)... can someone point me into the right direction?..thanks!
Having an excruciatingly hard time seting up a txtBox and listBox to search records
ListBox, which contains an agency name should display all but filter out as user types in the textBox above. this listbox should allow a user to double-click to bring up record.
Will really appreciate the help! I have seen it being done on Access – and was wondering if anyone knows of a link or tip on setting this up!
I currently have a ListBox which I am using on a form as a "jump To..." record selector. It has to show 4 values to the users, and so far it has worked quite well. However, I recently added some queries to the footer of the form to help narrow down the data for searches, or if the user wants to see all open data of a certain topic. I'd like to have the ListBox "refresh" and only display the results of the query, but I cannot for the life of me figure out how to do it. The root of the problem seems to be that the initial SQL for the ListBox is selecting values from the under-lying table, and when the filter is applied, it simply doesn't care. When you click on entries that aren't in the filtered dataset, it doesn't error out or anything, and when you click ones that ARE in the filtered dataset, it does work properly... I'm close... How do I filter the listbox as well?
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 ?