On Click Revisited

C

Claire

I can't quite get the Click event procedure to work with my code.



I would like the list box lstGstNew to be clicked in after it is requeried
but I am not having any success.



Private Sub cboProgress_AfterUpdate()

On Error GoTo PROC_ERR

If IsNull(Me.cboProgress) Then Exit Sub

Dim ctl As Control

For Each ctl In Me.Controls

If ctl.Tag = "lockup" Then

ctl.Locked = False

End If

Next ctl



SetCurrProgressNum (Me.cboProgress)

SetCurrProgressID (Me.cboProgress)



Me.Requery

DoCmd.Echo False

Forms![frmContracts].subDetail.SourceObject = "subblank"

DoCmd.SetWarnings False

DoCmd.OpenQuery "qryClearDetailTempTable"

DoCmd.OpenQuery "qryFillTempDetailTable"

Me.lstGSTNew.Requery

DoCmd.GoToControl "lstGSTNew"

DoCmd.SetWarnings True

Forms![frmContracts].subDetail.SourceObject = "subDetail"

CheckClosed

DoCmd.Echo True



Exit Sub



PROC_ERR:

MsgBox "The following error occured: " & Error$

Resume Next

End Sub



This is driving me crazy!! Any help is HUGE!!



Thanks

Claire
 
J

Jonathan Parminter

-----Original Message-----
I would like the list box lstGstNew to be clicked in after it is requeried
but I am not having any success.

Hi Claire, by 'clicked' I assume you to mean an item in
the listbox is selected. To select a item in the listbox
(for a single select) set the value property to an item in
the list. To set to the first item in the list use the
following as an example...

with lstGstNew
..value=.itemdata(0)
end with

Luck
Jonathan
 
C

Claire

Hi Katrina:

Well, at the moment, I have the cursor going to the lstGstNew control. If I
remove the GoTo Control command, the cursor is in the next field in the tab
order on the form.

Thanks
Claire

When echo is tunred back on, where is the cursor at?

Kat
 
C

Claire

Hi Jonathan, I will give that a try.

Thanks
Claire
-----Original Message-----
I would like the list box lstGstNew to be clicked in after it is requeried
but I am not having any success.

Hi Claire, by 'clicked' I assume you to mean an item in
the listbox is selected. To select a item in the listbox
(for a single select) set the value property to an item in
the list. To set to the first item in the list use the
following as an example...

with lstGstNew
..value=.itemdata(0)
end with

Luck
Jonathan
 
K

Katrina

so the cursor is at the lst control but it is not highlighted?

kat
Claire said:
Hi Katrina:

Well, at the moment, I have the cursor going to the lstGstNew control. If I
remove the GoTo Control command, the cursor is in the next field in the tab
order on the form.

Thanks
Claire

When echo is tunred back on, where is the cursor at?

Kat

Claire said:
I can't quite get the Click event procedure to work with my code.



I would like the list box lstGstNew to be clicked in after it is requeried
but I am not having any success.



Private Sub cboProgress_AfterUpdate()

On Error GoTo PROC_ERR

If IsNull(Me.cboProgress) Then Exit Sub

Dim ctl As Control

For Each ctl In Me.Controls

If ctl.Tag = "lockup" Then

ctl.Locked = False

End If

Next ctl



SetCurrProgressNum (Me.cboProgress)

SetCurrProgressID (Me.cboProgress)



Me.Requery

DoCmd.Echo False

Forms![frmContracts].subDetail.SourceObject = "subblank"

DoCmd.SetWarnings False

DoCmd.OpenQuery "qryClearDetailTempTable"

DoCmd.OpenQuery "qryFillTempDetailTable"

Me.lstGSTNew.Requery

DoCmd.GoToControl "lstGSTNew"

DoCmd.SetWarnings True

Forms![frmContracts].subDetail.SourceObject = "subDetail"

CheckClosed

DoCmd.Echo True



Exit Sub



PROC_ERR:

MsgBox "The following error occured: " & Error$

Resume Next

End Sub



This is driving me crazy!! Any help is HUGE!!



Thanks

Claire
 
C

Claire

Hi

The list box is selected, in that you can see the faint border around the
words, but the words should actually be black when you select an item in a
list box. That is what I am trying to make happen. If I click on the words
using the mouse, the choice is made. I need this to happen without the user
actually clicking in the list box.

Claire

so the cursor is at the lst control but it is not highlighted?

kat
Claire said:
Hi Katrina:

Well, at the moment, I have the cursor going to the lstGstNew control. If I
remove the GoTo Control command, the cursor is in the next field in the tab
order on the form.

Thanks
Claire

When echo is tunred back on, where is the cursor at?

Kat

Claire said:
I can't quite get the Click event procedure to work with my code.



I would like the list box lstGstNew to be clicked in after it is requeried
but I am not having any success.



Private Sub cboProgress_AfterUpdate()

On Error GoTo PROC_ERR

If IsNull(Me.cboProgress) Then Exit Sub

Dim ctl As Control

For Each ctl In Me.Controls

If ctl.Tag = "lockup" Then

ctl.Locked = False

End If

Next ctl



SetCurrProgressNum (Me.cboProgress)

SetCurrProgressID (Me.cboProgress)



Me.Requery

DoCmd.Echo False

Forms![frmContracts].subDetail.SourceObject = "subblank"

DoCmd.SetWarnings False

DoCmd.OpenQuery "qryClearDetailTempTable"

DoCmd.OpenQuery "qryFillTempDetailTable"

Me.lstGSTNew.Requery

DoCmd.GoToControl "lstGSTNew"

DoCmd.SetWarnings True

Forms![frmContracts].subDetail.SourceObject = "subDetail"

CheckClosed

DoCmd.Echo True



Exit Sub



PROC_ERR:

MsgBox "The following error occured: " & Error$

Resume Next

End Sub



This is driving me crazy!! Any help is HUGE!!



Thanks

Claire
 
K

Katrina

Do you have a specific item in the list that yu want selected? If you only
want the first item in the list selected(no matter what it is), where you
have
DoCmd.GoToControl "lstGSTNew"

put

Me.lstGSTNew.SetFocus
Me.lstGSTNew.Selected(0) = True

the 0 specifies the first item in the list

HTH
Kat
Claire said:
Hi

The list box is selected, in that you can see the faint border around the
words, but the words should actually be black when you select an item in a
list box. That is what I am trying to make happen. If I click on the words
using the mouse, the choice is made. I need this to happen without the user
actually clicking in the list box.

Claire

so the cursor is at the lst control but it is not highlighted?

kat
Claire said:
Hi Katrina:

Well, at the moment, I have the cursor going to the lstGstNew control.
If
I
remove the GoTo Control command, the cursor is in the next field in the tab
order on the form.

Thanks
Claire

When echo is tunred back on, where is the cursor at?

Kat

Claire said:
I can't quite get the Click event procedure to work with my code.



I would like the list box lstGstNew to be clicked in after it is requeried
but I am not having any success.



Private Sub cboProgress_AfterUpdate()

On Error GoTo PROC_ERR

If IsNull(Me.cboProgress) Then Exit Sub

Dim ctl As Control

For Each ctl In Me.Controls

If ctl.Tag = "lockup" Then

ctl.Locked = False

End If

Next ctl



SetCurrProgressNum (Me.cboProgress)

SetCurrProgressID (Me.cboProgress)



Me.Requery

DoCmd.Echo False

Forms![frmContracts].subDetail.SourceObject = "subblank"

DoCmd.SetWarnings False

DoCmd.OpenQuery "qryClearDetailTempTable"

DoCmd.OpenQuery "qryFillTempDetailTable"

Me.lstGSTNew.Requery

DoCmd.GoToControl "lstGSTNew"

DoCmd.SetWarnings True

Forms![frmContracts].subDetail.SourceObject = "subDetail"

CheckClosed

DoCmd.Echo True



Exit Sub



PROC_ERR:

MsgBox "The following error occured: " & Error$

Resume Next

End Sub



This is driving me crazy!! Any help is HUGE!!



Thanks

Claire
 
C

Claire

Well, it might not be the first item.

What is happening is that the list box is showing the correct item, but it
is not "clicking" on it. Whatever item is showing in the list box is what I
want selected.

I tried your code and the item in the list box is showing up as black, but
it still is not clicked. (But we must be getting closer!!) I still have to
physically click in the list box to make the calculation that relies on the
content of the list to update correctly.

C


Do you have a specific item in the list that yu want selected? If you only
want the first item in the list selected(no matter what it is), where you
have
DoCmd.GoToControl "lstGSTNew"

put

Me.lstGSTNew.SetFocus
Me.lstGSTNew.Selected(0) = True

the 0 specifies the first item in the list

HTH
Kat
Claire said:
Hi

The list box is selected, in that you can see the faint border around the
words, but the words should actually be black when you select an item in a
list box. That is what I am trying to make happen. If I click on the words
using the mouse, the choice is made. I need this to happen without the user
actually clicking in the list box.

Claire

so the cursor is at the lst control but it is not highlighted?

kat
Claire said:
Hi Katrina:

Well, at the moment, I have the cursor going to the lstGstNew control.
If
I
remove the GoTo Control command, the cursor is in the next field in the tab
order on the form.

Thanks
Claire

When echo is tunred back on, where is the cursor at?

Kat

Claire said:
I can't quite get the Click event procedure to work with my code.



I would like the list box lstGstNew to be clicked in after it is requeried
but I am not having any success.



Private Sub cboProgress_AfterUpdate()

On Error GoTo PROC_ERR

If IsNull(Me.cboProgress) Then Exit Sub

Dim ctl As Control

For Each ctl In Me.Controls

If ctl.Tag = "lockup" Then

ctl.Locked = False

End If

Next ctl



SetCurrProgressNum (Me.cboProgress)

SetCurrProgressID (Me.cboProgress)



Me.Requery

DoCmd.Echo False

Forms![frmContracts].subDetail.SourceObject = "subblank"

DoCmd.SetWarnings False

DoCmd.OpenQuery "qryClearDetailTempTable"

DoCmd.OpenQuery "qryFillTempDetailTable"

Me.lstGSTNew.Requery

DoCmd.GoToControl "lstGSTNew"

DoCmd.SetWarnings True

Forms![frmContracts].subDetail.SourceObject = "subDetail"

CheckClosed

DoCmd.Echo True



Exit Sub



PROC_ERR:

MsgBox "The following error occured: " & Error$

Resume Next

End Sub



This is driving me crazy!! Any help is HUGE!!



Thanks

Claire
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top