Click Function Problem - Code Help Required

C

Claire

Hi:

I'm having trouble getting my message across on this one. Hopefully, third
time lucky. Thanks to everyone that offered suggestions previously, but I'm
running out of time. I know I need to learn VBA unfortunately, time is not
on my side.

I need some code that will make access click in a list box for me, not go to
the list box, not set the focus to the list box, but physically click the
list box. The list box is currently showing the expected result, but in
order for a recalculation to take place on another form, you must physically
click in the list box.

I have tried many times, without success, to use _click to make this happen.
I know this should be really easy, but I am at my wits end. All of my
efforts end up with "Sub or Function not defined" or "Method or Data member
not found" errors.

Could somebody that KNOWS, please help me out with this one.

Below is the portion of my code that I am having trouble with:

Private Sub cboProgress_AfterUpdate()
Dim lstGstNew As Variant

Me.lstGstNew.Requery (correct result shows)
Me.lstGstNew.SetFocus (goes to the list box)
Me.lstGSTNew_click (blows up with Method or Data member not found
error)

A million thanks
Claire
 
R

rpw

Hi Claire

I had similar problem and saw yours (looking for solution). After searching by author, and reading your other posts and replys, I came with something that works for me. You might want to try it and see if it works for you. (I'll modify to your labels

Me.lstGstNew.SetFocu
Me.lstGstNew.Requer
Me.lstGstNew.Selected(0) = Tru
Me.lstGstNew.Selected(0) = Fals
Me.lstGstNew.Selected(1) = Tru
Me.lstGstNew.Selected(1) = Fals
Me.lstGstNew.SetFocu

This process seems to get the same results as a user clicking on the first and then the second selection in the listbox

Let me know if it worked, oK

rp

----- Claire wrote: ----

Hi

I'm having trouble getting my message across on this one. Hopefully, thir
time lucky. Thanks to everyone that offered suggestions previously, but I'
running out of time. I know I need to learn VBA unfortunately, time is no
on my side

I need some code that will make access click in a list box for me, not go t
the list box, not set the focus to the list box, but physically click th
list box. The list box is currently showing the expected result, but i
order for a recalculation to take place on another form, you must physicall
click in the list box

I have tried many times, without success, to use _click to make this happen
I know this should be really easy, but I am at my wits end. All of m
efforts end up with "Sub or Function not defined" or "Method or Data membe
not found" errors

Could somebody that KNOWS, please help me out with this one

Below is the portion of my code that I am having trouble with

Private Sub cboProgress_AfterUpdate(
Dim lstGstNew As Varian

Me.lstGstNew.Requery (correct result shows
Me.lstGstNew.SetFocus (goes to the list box
Me.lstGSTNew_click (blows up with Method or Data member not foun
error

A million thank
Clair
 
C

Claire

Hey rpw thanks for the effort, but it did not work for me..........

Hi Claire,

I had similar problem and saw yours (looking for solution). After searching
by author, and reading your other posts and replys, I came with something
that works for me. You might want to try it and see if it works for you.
(I'll modify to your labels)

Me.lstGstNew.SetFocus
Me.lstGstNew.Requery
Me.lstGstNew.Selected(0) = True
Me.lstGstNew.Selected(0) = False
Me.lstGstNew.Selected(1) = True
Me.lstGstNew.Selected(1) = False
Me.lstGstNew.SetFocus

This process seems to get the same results as a user clicking on the first
and then the second selection in the listbox.

Let me know if it worked, oK?

rpw

----- Claire wrote: -----

Hi:

I'm having trouble getting my message across on this one. Hopefully,
third
time lucky. Thanks to everyone that offered suggestions previously, but
I'm
running out of time. I know I need to learn VBA unfortunately, time is
not
on my side.

I need some code that will make access click in a list box for me, not
go to
the list box, not set the focus to the list box, but physically click
the
list box. The list box is currently showing the expected result, but in
order for a recalculation to take place on another form, you must
physically
click in the list box.

I have tried many times, without success, to use _click to make this
happen.
I know this should be really easy, but I am at my wits end. All of my
efforts end up with "Sub or Function not defined" or "Method or Data
member
not found" errors.

Could somebody that KNOWS, please help me out with this one.

Below is the portion of my code that I am having trouble with:

Private Sub cboProgress_AfterUpdate()
Dim lstGstNew As Variant

Me.lstGstNew.Requery (correct result shows)
Me.lstGstNew.SetFocus (goes to the list box)
Me.lstGSTNew_click (blows up with Method or Data member not
found
error)

A million thanks
Claire
 
J

John Vinson

I need some code that will make access click in a list box for me, not
go to
the list box, not set the focus to the list box, but physically click
the
list box. The list box is currently showing the expected result, but in
order for a recalculation to take place on another form, you must
physically
click in the list box.

I don't believe this is possible. What is the "recalculation" on the
other form? Could you post that code? What event is being triggered by
clicking the listbox - can you call that event explicitly, e.g.

Call lstMyListbox_AfterUpdate()
 
C

Claire

Absolutely excellent!!

Thanks for all of your help everybody. After more manipulation I finally
have what I need.

Thanks a million
Claire

Claire said:
Ooooh, so close!!

I added a Dlookup to my IIF and gave it a shot. It is finally calculating
but it keeps coming up with -1 (yes) for everybody so I know that I do not
have my calculation quite right.

I entered:
=IIf(DLookUp("ysnGSTExempt","qryCurrProgress")=No,([txtToDate]=[txtToDate]*0
.07),([txtToDate]=[txtToDate]*0))
snip

Hi Claire

You haven't specified any criteria in your DLookup so it will always return
the first record that meets your criteria (which is no criteria).
You need to specify whatever is the ID field for the current record.
Something like:
DLookUp("ysnGSTExempt","qryCurrProgress", "RecordID = " & Me!RecordID)
replacing RecordID with whatever your ID field is called.

Regards - Joe
 

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

Top