Click Function Problem - Code Help Required

  • Thread starter Thread starter Claire
  • Start date Start date
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
 
-----Original Message-----
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


It is not surprising that you are having trouble getting
a reply that helps. What you are trying to do is very
unconventional to say the least. Sorry if that sounds
critical it's just the way it is. If you have code
associated with the On Click event of the list box that is
doing what you want you should just copy it to where you
are trying to make the click event happen. That is the
line where you have Me.lstGSTNew_click (Which isn't a
valid operation) should be replaced with what ever event
you have in the On Click event of the list box. If you
have more specific requirements or information that could
help make your problem better understood, reply with it
and I will try and help more. Good Luck.
 
Hi Alan:

I know this is unconventional, unfortunately, I have adopted a database that
was originally programmed in Access 2. The logic is not the way that I would
have written it so I thought this would be easier than rewriting most of the
60 odd queries in this database.

However, I do not have any code associated with the On Click event of the
list box. I would like to make the list box invisible so that the end user
does not have to click in it at all. I would like the correct code to be
written in the After Update event of my combo box.

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)

I realize that the last line of the above code does not work........this is
what I need replaced with a valid function.

Thanks for your help Alan.
Claire

Alan Fisher said:
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)
-----Original Message-----
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:
A million thanks
Claire


It is not surprising that you are having trouble getting
a reply that helps. What you are trying to do is very
unconventional to say the least. Sorry if that sounds
critical it's just the way it is. If you have code
associated with the On Click event of the list box that is
doing what you want you should just copy it to where you
are trying to make the click event happen. That is the
line where you have Me.lstGSTNew_click (Which isn't a
valid operation) should be replaced with what ever event
you have in the On Click event of the list box. If you
have more specific requirements or information that could
help make your problem better understood, reply with it
and I will try and help more. Good Luck.
 
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))

Can you see anything obvious.........I think I've stalled out on this
thing....

Thanks
Claire

OK, I will give that a try this afternoon. Stay tuned!1

Thanks
Claire
The listbox shows either yes or no
depending on a checkbox for each record in the underlying query.

Well... skip the middleman; use DLookUp on the underlying query rather
than relaying through the listbox!
 
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
 
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
 
Back
Top