> Requery List7 after you set the Row Source: Me.List7.Requery
> Call the click option for List7: Call List7_Click
Still takes two clicks on the option button to sync. Modified code:
--------------------------------------------------------
DoCmd.GoToControl "[List7]"
Me![List7].Requery
Call List7_Click
Me.[List7].Selected(1) = True
-----------------------------------------------------------
Conceptually, what you have suggested should have worked, since it adds
a "click". However, if I try it after "Me.[List7].Selected(1) = True",
I get an an error message that the action was cancelled by an undefined
object. The reason for attempting to put "click" after
"Me.[List7].Selected(1) = True" is that this where the code hangs
(requires the double click). Prior to this line the value of the first
entry has not yet been selected so a click would be on value that had
not yet been established.
I am thinking of an alternative approach, that being a cloned recordset
based on the option box criteria and then displaying the first record.
I am reading one of the programming books on how to use a cloned
recordset.
ortaias@hotmail.com - 30 Jun 2006 17:01 GMT
I ran debug.print
----------------------------------------------------------------------------
CLICK7 Executed - List7= 20040012
CLICK7 Executed - List7= 20040012
Before Me.[List7].Selected(1) is executed= 20040012
After Me.[List7].Selected(1) is executed= 20040012
------------------------------------------------------------------------------
It would appear that "Me.[List7].Selected(1)" causes "CLICK7" to
execute before it is iteself executed. A problem whith that
intepretation is how LIST7 would get the value "20040012"???
I revised the program to "Call_Click7" and execute
"Me.[List7].Selected(1)". In theory it should have taken care of the
double clidk problem, but now I get an error message that the operation
was canceled by an associated object.
---------------------------------------------------------------------------------------------------------------
Private Sub Frame33_Click()
Select Case Frame33
Case 0 'show all records
Me![List7].RowSource = "SELECT [projectnum], [projectname] FROM
projectnumqry; "
Case Else 'show limited (filtered) list
Me![List7].RowSource = "SELECT [projectnum], [projectname] FROM
projectnumqry where [type]=[frame33];"
End Select
[Text29] = [List7].ListCount - 1
DoCmd.GoToControl "[List7]"
frame33ran = True
Call List7_Click
End Sub
Private Sub List7_Click()
Rem Pulls-up the summary form information for the selected project
If Frame33 Then Me.[List7].Selected(1) = True: frame33ran = False
Me.Recordset.FindFirst "[projectnum] = " & Me.[List7]
Call setcontrols
End Sub
Jeff L - 30 Jun 2006 20:33 GMT
Trying something a little different:
Private Sub Frame33_Click()
Select Case Frame33
Case 0 'show all records
Me![List7].RowSource = "SELECT [projectnum], [projectname] FROM
projectnumqry; "
Case Else 'show limited (filtered) list
Me![List7].RowSource = "SELECT [projectnum], [projectname] FROM
projectnumqry where [type] = " & Me.Frame33 & ";"
End Select
[Text29] = [List7].ListCount - 1
Me.List7.SetFocus
Call List7_Click
End Sub
------------------------------------------
Private Sub List7_Click()
Rem Pulls-up the summary form information for the selected project
Me.Recordset.FindFirst "[projectnum] = " & Me.[List7]
Call setcontrols
End Sub
ortaias@hotmail.com - 30 Jun 2006 21:47 GMT
In theory, everything should work, but I am still stuck with double
clicking. I think that the "[List7].Selected(1)" statement creates a
pending action that is not cleared. I think I will just add a note at
the top of the optionbox to click twice. Even if a person does not
click twice, clicking on the listbox syncs the form. So it self
corrects easily. Other than the mental excercise of solving the
problem, its not worth the time since a simple double click works.
Also it is quiting time, and I won't be back till July 5th. Thanks very
much for your advice and the realy good tips. They will be useful.