By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,659 Members | 1,939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,659 IT Pros & Developers. It's quick & easy.

After Update not working with combo box

BHo15
100+
P: 142
My last couple of questions were things I had not dealt with. But now... I'm having trouble with something I literally do all of the time.

Using the After Update event on a form's combo box to populate other fields. Why oh Why is it not working.

My combo box is a doctor's name selection. After that populates, I want to pull in other information from a table into other fields. Here is the code...

Expand|Select|Wrap|Line Numbers
  1.         Me.txtPCPGroup = DLookup("PCPGroupName", "tblCoderPCPs", "PCPName='" & Me.txtPCP & "'")
  2.         Me.txtPODIPA = DLookup("PODorIPAName", "tblCoderPCPs", "PCPName='" & Me.txtPCP & "'")
  3.         Me.txtPrevOffice = DLast("VisitContactDate", "tblEntries", "PCPName='" & Me.txtPCP & "' AND CoderID = " & Me.CoderID)
  4.         Me.FormDeploymentMethod = DLookup("FormDeploymentType", "tblCoderPCPs", "PCPName='" & Me.txtPCP & "'")
  5.         Me.Total2018Membership = DLast("Total2018Membership", "tblCoderPCPs", "CoderID=" & Me.CoderID)
I have tried Red dots (which it never hits), I have tried rebuilding the form, and have event tried rebuilding the database. Nothing has worked.

Thoughts?
Mar 18 '18 #1

✓ answered by NeoPa

Try putting the Breakpoint on the line that says :
Expand|Select|Wrap|Line Numbers
  1. Private Sub XXX_AfterUpdate(...
If it triggers then follow the execution of the code using F8 or Shift-F8 and see where it goes awry.
If it doesn't trigger then you need to get the object relinked to its code. The easiest way to do that is to select the whole module; cut it; then paste it again. Any events that are properly named and formatted will be relinked automatically for you.

Share this Question
Share on Google+
8 Replies


NeoPa
Expert Mod 15k+
P: 31,487
BHo15:
I have tried Red dots (which it never hits),
If you look at Debugging in VBA you should see that if the red dot (Breakpoint) is not hit then the issue is not in that code at all. Somehow it isn't even running that code.

That's helpful to know, but it means the code you've included isn't the code we need to see ;-)
Mar 19 '18 #2

NeoPa
Expert Mod 15k+
P: 31,487
Try putting the Breakpoint on the line that says :
Expand|Select|Wrap|Line Numbers
  1. Private Sub XXX_AfterUpdate(...
If it triggers then follow the execution of the code using F8 or Shift-F8 and see where it goes awry.
If it doesn't trigger then you need to get the object relinked to its code. The easiest way to do that is to select the whole module; cut it; then paste it again. Any events that are properly named and formatted will be relinked automatically for you.
Mar 19 '18 #3

BHo15
100+
P: 142
The module is a form. I cut the code and pasted it in notepad, then restarted the database. I then pasted the code back in.

I put a red dot on private sub cboPCP_AfterUpdate. When a selection was made, the code ran this time. But it did not stop on the red dot.

I thought it was interesting that even when I removed all the code, the form still remained in the navigator pane of the VBE.
Mar 19 '18 #4

NeoPa
Expert Mod 15k+
P: 31,487
BHo15:
But it did not stop on the red dot.
In truth I normally set it to the first line, but as I don't know your code it was easier to say use that one. Did it stop at all or did it just work and you weren't fussed by that time?

BHo15:
I thought it was interesting that even when I removed all the code, the form still remained in the navigator pane of the VBE.
That's a bit like the difference between a Null and an empty string (""). You can have a module with nothing in it. You can also have objects with no associated modules at all. An empty module is still a module so should show up in the VBIDE window.
Mar 19 '18 #5

BHo15
100+
P: 142
In answer to your first question... I tried both the Private Sub line, and the line below. No stoppage on any of the red dot locations, but it did run correctly.

I get what you are saying about the empty module.

Finally... I ended up copying all of the code, and then rebuilding the forms on another computer, and pasting the code in. It worked like a champ. The only difference I know of between the two computers is that the problematic one is running Office 16, and the other one is running Office 13.
Mar 19 '18 #6

NeoPa
Expert Mod 15k+
P: 31,487
BHo15:
The only difference I know of between the two computers is that the problematic one is running Office 16, and the other one is running Office 13.
I assume 2013 & 2016?

I don't know why it isn't behaving as expected for the Breakpoint but I guess if it's working we can move on.

If you struggle with debugging at any time just open a new thread and we can explore it with you. Like most things, when you look closely enough you find the bit that's causing the problems.
Mar 20 '18 #7

BHo15
100+
P: 142
Thanks NeoPa. Yes indeed 2013 and 2016. Interesting enough, my computer that had 2013 was upgraded to 2016 today. AND... Can't stop on the red dots!

I guess I could use Stop in the code if I need it to break.
Mar 20 '18 #8

NeoPa
Expert Mod 15k+
P: 31,487
If you're still having problems with that - even after going through Debugging in VBA - then post a new question and i'll see what I can do for you.
Mar 21 '18 #9

Post your reply

Sign in to post your reply or Sign up for a free account.