Finally found the answer...
Since I was using a checkbox to fire off the code, the focus had moved away from the listbox. The following works:
Me!lstPolicy.SetFocus
Me!lstPolicy.ListIndex = 0
Thanks, everyone, for your help.
Keith
Thanks Jeremy,
It does work to set the first item in the list box to "selected" but does not work to cause the listbox to scroll back to the top. My list is longer than the listbox, so am having trouble redisplaying the top of the list.
Thanks,
Keith
Thanks, but the MoveFirst doesn't seem to want to work in this situation. I think that it would work if this was a normal record set but a list box seems to behave differently.
Keith
Sure,
After reviewing, am seeing that it is not the load or the check and clear all that is scrolling to the end of the list box. I would just like to automatically move back to the beginning of the list as a cleanup.
The code below is not the load I referenced earlier...
Hello,
I am using some VBA to iteratively load selected items from a ListBox into a parameter table. After the VBA finishes executing, the focus of the ListBox seems to be on the final record.
Is there an easy VBA way to reset the focus to the first ListBox item while not accidentally...
Rob,
The approach below may not be the most efficient but
seems to work. I have attached the code the "click"
event of "Button1" on my form but you should be able to use
the "Rst.RecordCount" wherever you desire. This uses
the Form's RecordsetClone property...
Rob,
The approach below may not be the most efficient but
seems to work. I have attached the code the "click"
event of "Button1" on my form but you should be able to use
the "Rst.RecordCount" wherever you desire. This uses
the Form's RecordsetClone property...
A friend found the answer for me on HelpTalk. Thought I
would post it here for the sake of completeness.
...
Problem: lost export to file types
This is a problem that can drive you up the wall trying to remedy if you don't know the reason and the fix.
Uninstalling and installing Office or...
.xls is not showing up as an option in the Import
window in MS Access 97. We are following the directions
to remedy this by going through the Add/Remove, Date
Access, Change Option but this is not helping. When
it gets to the Drivers window, it shows the Microsoft
Excel Driver as already...
Sorry folks. Works for me. I even created
a table and field with the exact names as above
so that I could copy and paste Psalm6229's SQL
straight into the SQL view. Still worked. For
what it's worth, I defined CKPCode as a text field.
Also am using Access 97.
I'll keep thinking.
Here is the...
Data:
SerialNo FailDate StartTime
X 01/01/2001 01/01/2001
X 01/01/2001 01/02/2001
X 01/01/2001 01/03/2001
Y 01/02/2001 02/05/2001
Y 01/02/2001 02/06/2001
Y 01/02/2001 02/07/2001
SQL:
SELECT Table1.SerialNo, Table1.FailDate,
Min(Table1.StartTime) AS MinOfStartTime
FROM Table1
GROUP BY...
Try using the DCount function. This saves
you from having to instantiate a recordset.
Here's an example from the Access 97 help:
Syntax: DCount(expr, domain[, criteria])
Example:
intX = DCount("[ShippedDate]", "Orders", _
"[ShipCountry] = 'UK' AND [ShippedDate] >...
Often times I need to refresh(empty) 1 or more tables
prior to running a process.
I've noticed that, when I use a Delete in a Macro or
Module to do this, the records are deleted instantaneously,
even for relatively large numbers of records.
Selecting all records and deleting via the...
GGW,
I'm thinking the modifications below will come closer
to accomplishing what you are after.
Hope this helps,
Keith
Dim MyDB As Database
Dim MyQDef As QueryDef
Dim SQLString As String
Dim rstSchedule As Recordset
Dim rstMasterQuestionList As Recordset
Dim Expr1 As Long
Dim Expr2 As Long...
I would like to be able to join two tables using something
like 'Table1.Age BETWEEN Table2.MinAge and Table2.MaxAge'.
Is this possible in access?
Thanks,
Keith
...
Set obj = CreateObject("Excel.Application")
MsgBox obj.Application.Median(1,2,5,7,8)
obj.Quit
Set obj = Nothing
...
The code above works fine to return the Median of the
set of numbers hardcoded. What I really need though
is the ability to use...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.