Keep Focus In Listbox

Oct 25, 2004

I am working in a county jail and we are doing a database where you select the living unit location (example: 1A,1B,2A,2B) from a listbox. The problem is that most entries are multiples on the same unit. I would like the unit selected to stay as the current default when the next record is started. As it stands now, as soon as you enter the record, all focus in the listbox is lost. (example, there are 3 items on 1A. After 1st item is saved in record, 2nd record should start with 1A highlighted (selected?) in text box rather than having to click on it or select it) Is there a way to do this? This would greatly improve my data entry time. Thanks in advance!!

View Replies


ADVERTISEMENT

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

Set Focus Nothing?

Mar 24, 2005

I have several forms and subforms that display data, but are not used for data entry. The first textbox on every form gets the focus on open. I'm sure I've seen some way to open the form with no focus on any control!

Can someone help me remember?

Thanks,

Sup

View 3 Replies View Related

Get Focus

Apr 15, 2005

thanks for helping.

how do i get a record to get focus when a form opens or a button is clicked on?

thanks again

View 2 Replies View Related

Set Focus

Jan 9, 2006

I am having trouble getting the cursor to change focus after updating a field in my tab control subforms. I have a main form with a tab control and 4 related subforms for each record in the main form.

I have a calendar that pops up with the On Click of my Date field. When the date is selected, it enters it into the field and the calendar closes. For some reason though the user cannot simply go to the next record with the mouse and has to tab to or select another field in the same record first and then click on the Date field in the next record.

I have tried SetFocus to "Hours" (the next field after "Date")and "NextRecord" on every Event I can think of but it does nothing, it just stays on the changed field and the only way to get out of it is to go to another field. I've tried saving, requery, etc. I've also tried the options shown in the forum with no luck and using different events associated with the Calendar form - On Close, Lost Focus, etc.

Any suggestions? Thanks

View 6 Replies View Related

Which Tab Has Focus

Nov 9, 2006

I have a form that has 9 tab pages. I have an amend button in the form footer that will do a different thing depending on which tab has the focus. How can I find out which tab has got the focus when I click the Amend button?

View 2 Replies View Related

Could Not Set Focus

Nov 30, 2006

Hi

I have a problem with setting focus to a text box. There is a listview on the form. Double clicking on a row will search the database for that record using SNo field and then display the contents on the respective control. When I click on a row the first time, it works. Clicking on the second row immediately gives the error "error 2110 - Access cannot set focus to the control txtReference.
Here is the code.......
Private Sub lvwOrders_DblClick()
ClearAll
Set rs = New ADODB.Recordset



rs.Open "SELECT * FROM tblOrderEntry where sno=" & ListView.SelectedItem, con, adOpenKeyset, adLockPessimistic
lblFooter.Caption = "Edit Record"

subRetrieve

End Sub



Private Sub subRetrieve()
Form_OrderEntry.SetFocus
With rs
For i = 0 To lstCostCenter.ListCount - 1
If lstCostCenter.ItemData(i) = !CostCenter Then
lstCostCenter.Selected(i) = True
Exit For
End If
Next i

txtReference.SetFocus
txtReference.Text = !ReferenceNo

txtOrderNumber.SetFocus
txtOrderNumber.Text = !OrderNo

For i = 0 To lstCostCenter.ListCount - 1
If lstCostCenter.ItemData(i) = !CostCenter Then
lstCostCenter.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstDescription.ListCount - 1
If lstDescription.ItemData(i) = !Description Then
lstDescription.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstOrderStatus.ListCount - 1
If lstOrderStatus.ItemData(i) = !OrderStatus Then
lstOrderStatus.Selected(i) = True
Exit For
End If
Next i


For i = 0 To lstSalesRep.ListCount - 1
If lstSalesRep.ItemData(i) = !SalesRep Then
lstSalesRep.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstPaymentMethod.ListCount - 1
If lstPaymentMethod.ItemData(i) = !PaymentMethod Then
lstPaymentMethod.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstCallType.ListCount - 1
If lstCallType.ItemData(i) = !TypeofCall Then
lstCallType.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstStatus.ListCount - 1
If lstStatus.ItemData(i) = !Status Then
lstStatus.Selected(i) = True
Exit For
End If
Next i

If !Status = "Pending" Then
txtReasons.Visible = True
lstAssign_Reasons.Visible = False
txtReasons.SetFocus
txtReasons.Text = !Reason
ElseIf !Status = "Assign" Then
lstAssign_Reasons.Visible = True
cmdSave.SetFocus
txtReasons.Visible = False
For i = 0 To lstAssign_Reasons.ListCount - 1
If lstAssign_Reasons.ItemData(i) = !Reason Then
lstAssign_Reasons.Selected(i) = True
Exit For
End If
Next i
End If


End With
End Sub

What can be going wrong ?

View 3 Replies View Related

Setting Focus On Tab

Apr 11, 2008

Hi everyone,

how would i go about setting focus on a tab control? i have a tab control on a form with 6 tab pages. i am on page 4 ( bank ) and i have a button to add a bank account. this opens up the add form and i add the account. i then requery the form and the tab goes back to page 1. how do i set the focus back to the previous opened tab?

many thanks,


Nigel

View 2 Replies View Related

Set Focus On Form

Jan 28, 2005

I have a form, and when it opens it has focus on a box i dont want it to focus on

How do i change which box it has focus on when it is opened?

View 3 Replies View Related

Focus Problem

Feb 22, 2005

I have two buttons on a form, one of them adds default information to three boxes, the other clears the info. I want to be able to hide one o the buttons depending on what is in the box.

I know I need to change the focus away from the control in order to hide it, but how do I do it please?

I have this so far, but there is something missing!

Private Sub Command744_Click()
Me.BdeRec40kMarksmanship = Null
Me.BdeRec40kFireStatus = Null
Me.BdeRec40kOpening_Range = Null
Me.Command743.Visible = True
Me.command777.Visible = False

End Sub

View 2 Replies View Related

Subforms Focus

Mar 21, 2005

i have a main form, in which i have included 2 subforms on it. Now when i am at the last control on the main form, the focus moves to the first control of one of the subforms. However, when i am at the last control of this subform, on hitting the tab key, the focus does not move to the first control of the other subform.

How can i achieve this please?

Thank you!

View 1 Replies View Related

Focus Problem, I Think...

Apr 6, 2005

I have a form that allows a user to select from a variety of options and then generate a report. It consists of three option groups:

1) Select a Team: A B C

2) Select a Report: A B C

3) Input a Date Range: From (blank) to (blank)

If you progress down the list and finish entering the enddate and then click the mouse on the Run Report button, nothing happens. The cursor remains blinking in the enddate field. You have to manually re-select one of your previous options on the form to get rid of the flashing cursor and then re-click the Run Report button to generate the report.

The option to include the Run Report button in the tab order is not available, I don't know why, but it is an image if that makes a difference.

Any ideas? I'm thinking I have to set focus for something. I just don't know when or where.

Thanks for all replies!

View 1 Replies View Related

How Do I Set The Focus To The Next Record And.....

Apr 25, 2005

How do I delete this dummy record?

http://img.photobucket.com/albums/v401/Rrotz/phonelog1.gif

Also, how do I set the form to maximize fully like the above, when I open the form it defaults to this:

http://img.photobucket.com/albums/v401/Rrotz/phonelog.gif

View 2 Replies View Related

Get Focus On A Control

Apr 29, 2005

Hi

I would like a control to have focus when a form is opened or press a button - how do i do this?

Many Thanks

View 1 Replies View Related

Focus On A Form

May 26, 2005

How do i choose the field i want my focus to be on when a form i opened?

View 1 Replies View Related

Object Focus

Jul 8, 2005

I'm trying to force a user to enter text into a field. To this end, I've created a subroutine for the exit method of the text box they are supposed to fill out. I check to see if the .text property is null, and if so create a message box that pops up a notification telling the user they need to fill in said field. After that, I try to use the Me.txtReason.SetFocus (the text box is called txtReason) to return the focus to that text box, but instead it moves on to the next text box. Is there a way I can prevent the user from leaving the text box until they've entered some sort of data into it?

Thanks,
Dave

View 4 Replies View Related

Outa Focus~~~~

Sep 14, 2005

Little problem with a form and subform. Problem is...I don't know why I'm having this problem! :)
Have a form with a subform. Everything is working correctly,with one exception. The form is entering payments (checks) then the subform handles the distribution. So after you input one or more lines on the subform you click the "new record" icon. Problem is the focus stays in the subform and not to the top of the main form. I know I could code it to force it to set focus to the first field on the main form... BUT.. I've done this before and coding was not needed. So what did I do wrong on this one?
Thanks

View 6 Replies View Related

List Box Focus

Nov 8, 2005

Hi

I have a list box setup with all the dates from 01/10/05 to 31/12/08.

I want to always start the list box at the current date while still allow the functionality to backdate if required.

I have used the undernoted code to set the row correctly but I cannot figure how to get the box to scroll down to the correctly selected row.

Dim i As Long

i = DLookup("ID", "tblIMDates", "cdate([Date])=date()") - 1

Me.lstDates.Selected(i) = True

Any ideas?

JC

View 5 Replies View Related

Set Focus To The First Field

Mar 7, 2006

I moved the Address field from third postion to first position, so that clicking on a list box places the address from the List Box into the Address field. I adjusted the bound and source boxes and it works perfectly. The cursor now points to the Last Name field (second position, which it did originaly.) I would like the cursor to point to the Address field so as not to confuse the operator. How can this be accomplished? I am sure the correct Event code will do the tick.

View 2 Replies View Related







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