Cycling Itemselected On A Listbox

Apr 10, 2008

Hi All,

I have the following code that Cycles through a listbox that has columns associated to it:

Dim db As DAO.Database

Set db = CurrentDb

lstOrigin.SetFocus
For i = 0 To lstOrigin.ItemsSelected.Count - 1
txtAmount.SetFocus
For x = 1 To CInt(txtAmount.Text)
strsql = "insert into tmpJob select dbo_jtJob.* from dbo_jtJob where jtJobId = " & lstOrigin.Column(0)
db.Execute strsql
Next
Next

This code works fine and so if I multi-select the lstOrigin.Column(0) value changes correctly as expected..

I now have a second listbox also set with columns and set for multiselect:

The code I have for this is :

Dim i As Integer
Dim strCriteria As String

strCriteria = "key in ("
lstDestination.SetFocus
For i = 0 To lstDestination.ItemsSelected.Count - 1
strCriteria = strCriteria & lstDestination.Column(0) & ", "
Next
strCriteria = Left(strCriteria, Len(strCriteria) - 2) & ")"
DoCmd.OpenForm "JobCreateTemplate", , , strCriteria, , acDialog

Now in this one lstDestination.Column(0) always equals the last item in the items selected index. It iterates the loop the correct number of times. I cannot see what I've done different that the process works in the first lot of code and not the second.

This is Access 2003

View Replies


ADVERTISEMENT

Question About Cycling Through .mdb's

Feb 15, 2006

I have a project that contains about 200 very small .mdb's. For reasons that make no sense, I have to keep all these little .mdb's separate.

What I'm interested in doing is to run a query against a table in each of the .mdb's and if I find a certain record in the table within each .mdb, have a record written that contains the name of the .mdb in which the record was found . In other words, cycle through all my .mdb's, check my specified table, write my notification record, and then repeat the process for the next .mdb.

Can this be done? Does anyone have an idea or suggestion? I know I can do this separately, but that would be a pain.

If anyone can offer assistance, I would be most appreciative. Thanks!

View 14 Replies View Related

Trigger A Function When Cycling Records

Aug 10, 2005

hello i wish to trigger some VBA code when the user jumps from the present record to some other record on the form. there is the On Current event but that only applies to the record you are jumping to. i wish to process the information on the present record if u choose to jump to some other. BTW my form my form only shows one record at a time.
Please help me out here. :confused:

View 3 Replies View Related

Cycling Thru Record In A Query In Code

Jun 12, 2005

I'm trying to set up a looping code to go thru each record in a query. I know in excel I would set the cell value to a range and offset to get to the next value. How is this done in Access?

View 1 Replies View Related

Reports :: Print Report Cycling Through List Box

Jul 10, 2014

I have a form with a list box, which lists all those registered for a student orientation. I then have a button to an unbound report which prints a registration worksheet. This report looks up the student's name, test scores, suggested courses based on those scores, and various other information from multiple tables, assigns them to variables, then to controls on the report. This is done in the On Open event of the report.

But it was designed to work for record highlighted. Which was fine until now. Now I'd like to take it one step further and have it go through the list from beginning to end, printing the report for each record in the list.

Maybe I am missing something simple, but I can't seem to pull it off. The closest I can get is getting it to print the first record n times.

View 10 Replies View Related

General :: Identify Cycling / Fluctuations In A Time Series Data?

Mar 12, 2013

I am trying to find an algorithm to identify patterns in my data.

My task is to accomplish whether the data shows a very sharp decline and whether or not it follows previous fluctuation.

If it declines sharply and doesn't follow previous fluctuations it will indicate a production problem.

My time series data is as follows.Also sharp decline according to the below data is highlighted.

Data
-0.027663709
-0.057051957
-0.077941988
-0.070009989
-0.033860193

[code]....

View 2 Replies View Related

Copying Data Within Same Form From A Listbox Containing A Query To A Blank Listbox?

Apr 21, 2006

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 :)

View 1 Replies View Related

Forms :: Dynamic Row Source For Listbox From Multi-select Listbox

Jun 10, 2015

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.

View 5 Replies View Related

Forms :: Listbox To Show Types Based On Section In Other Listbox

Sep 9, 2013

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?

View 1 Replies View Related

Forms :: Passing Listbox Rowsource To Another Form Listbox

Dec 14, 2014

Using a popup form

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

View 3 Replies View Related

Forms :: Make Listbox Visible After Selection Of Another Listbox

Oct 23, 2013

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?

View 7 Replies View Related

Select All Listbox AND Update Listbox

Jun 17, 2005

Hello,

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"

End If

Exit_cmdSelectAll_Click:
Exit Sub

Err_cmdSelectAll_Click:
MsgBox Err.Description
Resume Exit_cmdSelectAll_Click

End Sub

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?

Tnx a lot!

View 13 Replies View Related

Move Items From Listbox To Other Listbox

Jul 16, 2006

Hello everybody,

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.

View 4 Replies View Related

Forms :: Hide Unchecked Values In A Listbox - Create Hyperlink On Listbox Values?

Jan 20, 2014

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?

View 10 Replies View Related

ListBox

Nov 23, 2006

What I am trying to do is to swap item position in ListBox without adding/removing items. Index doesn't need to change, but the text show in the ListBox need to. For example.

lstField contains:
Item 1
Item 2
Item 3 (selected)

What I want to do is when click a button (cmdUp) the Item 2 should be Item 3 and Item 3 should be Item 2

Item 1
Item 3
Item 2

How can I do this in MS Access.
Please let me know.

View 2 Replies View Related

About Listbox

Jul 12, 2007

1)How to set show or not show key column for list box in propeties windows?
2)For list box, after doing
lstListBox.rowsource="select field1, field2 from tbl"
lstListBox.requery
How to
a)Set show keycolumn;
b)make the first item in the listbox selected?A

View 1 Replies View Related

ListBox

Feb 8, 2005

I have a list box that displays different times. Can some one help, how do get the value from the list box that was selected to show in a text box on another form?
Thanks

View 3 Replies View Related

Listbox

Mar 7, 2005

I have a list box on a form. What I want to do is get the value of one field in the first line of data in the list box.

View 1 Replies View Related

ListBox

Jul 18, 2005

I've been searching through all the forums and sample databases for listbox searches and can't seem to make head or tails of them. They are all so different and I can't seem to get something to work.

Could someone please point me in the direction of a fairly simple listbox search that I can understand.

Basically I have two cascading combo boxes and would like to search after this has been filtered into the listbox. Then I would like to select one of the options and have the whole record show up. Any help at all in pointing me in the right direction would be extremly helpful. I've been working on trying to get a search function to work for 3 days and haven't had any luck at all.

View 1 Replies View Related

ListBox

Oct 5, 2005

I would like the ability when I select multiple items in a list box, to count the selected items. I have a email management Module and I have users select multiple emails from this list to perform group emailing. I would like to provide a number of selected emails. Does anyone know how. I am trying to avoid several hours of worki in trying to figure this out. I apreciate it,

Thanks Antonio

http://www.newgenerationaccess.com
Application & Database Development Company

View 1 Replies View Related

Listbox Help!

Dec 2, 2005

I have a form with a listbox on it. the list box contains site numbers. (lstSite)

i would like the user to select which site/s they want information for.

i have another query that includes site,date,and other data
i put in the criteria for site as being forms!main!lstSite.value but it is not showing any records, even if i did select the site. i also tried forms!main!lstSite. this did not work either.

I have a feeling i am refering to the object incorrectly.

any help would be greatly appreciated

tkaplan

View 1 Replies View Related

Listbox Woe's

Jan 9, 2006

I have a form with a listbox in it. the list boxed is used to select an item to view in the sub form. All is well except when i try to add an item to the list box. I have set up a macro to enter new data in the list box by opening the table that supports it and entering the new data. what i need is for the list box to update and show the new information entered automatically. as of now i need to close the form and reopen it to view the changes.

thank you

View 3 Replies View Related

Using Listbox

Feb 19, 2006

I am trying to find out whether is possible to eliminate values that appear twice or more in a list box menu. I don't want to remove an entire record.Just a value that appears many times...

Thanx
Kyriakos

View 1 Replies View Related

Listbox Help

Dec 11, 2006

I am developing a database for my work to keep track of volunteers we get for community service hours. I have the following tables:

tblVolunteers
VolunteerID (PK)
FirstName
LastName
Address
City
State
Zip
Phone
DateAdded
Notes

tblFiles
FileID (PK)
VolunteerID (FK)
OpenDate
HoursRequired
DueDate
Status
Notes

tblProjects
ProjectID (PK)
Description
Instructions
Status
Priority
DueDate
DateAdded
Notes

tblTransactions
TransactionID (PK)
FileID (FK)
ProjectID (FK)
TransactionDate
TimeIn
TimeOut
StaffInitials
Notes

I have a form where a staff person searches for the volunteer they will be signing in. A listbox displays all the volunteers in the system. They select a name, then click open, and the sign-in form opens to that volunteer. Right now the only thing on the form is the volunteer contact info. I would like to put a listbox next to it that will show all the Files for that volunteer. What I then want to be able to do is click on that file and have a subform show all the transactions (Date, Time In, Time Out, etc…). I’m just not sure how to write the rowsource for the listbox.

Please if you have any questions if I did not clarify myself, please ask!

Thanks ahead of time!
ScrmingWhisprs

View 2 Replies View Related

Listbox

Dec 20, 2006

Hi,

how can i populate some empty fields/comboboxes by clicking a record in the listbox?

the details are stored in my table..................??

thanks

View 5 Replies View Related

ListBox

Jan 24, 2006

I’m new to access so I hope you will have some patience with me. I have a listbox that receives a list of tools from a table. I created a command button that takes the user selected items and stores them in a text box. I copied some code and I understand what it is doing but, I need a list of data instead it is separating the data by a comma?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved