UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V < 1 2  (Go to first unread post)
   Reply to this topicStart new topic
> Vbcancel Not Working, Access 2010    
 
   
guitarsweety
post Aug 20 2017, 12:55 PM
Post#21



Posts: 189
Joined: 1-December 11
From: Mt Airy, NC


It works and really I'm afraid to change anything. I've tested it 20 plus times and does exactly what I want it to.
Go to the top of the page
 
GroverParkGeorge
post Aug 20 2017, 12:58 PM
Post#22


UA Admin
Posts: 31,195
Joined: 20-June 02
From: Newcastle, WA


Okay, that's totally understandable. As I say, though, I'd be surprised to learn that it works because the variable prompt is actually being set to anything. Rather, I think it works because the first conditional either does run the query or doesn't run it, and the second one does nothing.

Have you put a break point in the code to step through it?

--------------------
Go to the top of the page
 
guitarsweety
post Aug 20 2017, 01:27 PM
Post#23



Posts: 189
Joined: 1-December 11
From: Mt Airy, NC


You're more than welcome to take a look at it Attached File  Labels.zip ( 277.91K )Number of downloads: 1
Go to the top of the page
 
GroverParkGeorge
post Aug 20 2017, 01:36 PM
Post#24


UA Admin
Posts: 31,195
Joined: 20-June 02
From: Newcastle, WA


Yup, just as I thought.

These lines do nothing.


CODE
  If prompt = vbNo Then
    Exit Sub
    End If


At this point, prompt will ALWAYS be 0 because nothing in the preceding code sets it to anything else.

VBNo equates to 7. Not to 0 and not to "No".

These buttons have values based on this list:

VBA Msgbox Constants

The reason it looks like the code does what you want is that the CASE statement drops to the End Select statement which is just before the Exit Sub it encounters there.

--------------------
Go to the top of the page
 
guitarsweety
post Aug 20 2017, 01:39 PM
Post#25



Posts: 189
Joined: 1-December 11
From: Mt Airy, NC


Guess I just got lucky smile.gif I did change this


CODE
If prompt = 7 Then
Go to the top of the page
 
GroverParkGeorge
post Aug 20 2017, 01:43 PM
Post#26


UA Admin
Posts: 31,195
Joined: 20-June 02
From: Newcastle, WA


Still no cigar.

"prompt" is NOT SET ANYWHERE. It will always be 0, which is the default.

I'm going to annotate your code and return it.

--------------------
Go to the top of the page
 
GroverParkGeorge
post Aug 20 2017, 01:55 PM
Post#27


UA Admin
Posts: 31,195
Joined: 20-June 02
From: Newcastle, WA


Attached File  Labels_Modified.zip ( 297.77K )Number of downloads: 1

--------------------
Go to the top of the page
 
guitarsweety
post Aug 20 2017, 02:02 PM
Post#28



Posts: 189
Joined: 1-December 11
From: Mt Airy, NC


NOTHING works in the file you modified
Go to the top of the page
 
GroverParkGeorge
post Aug 20 2017, 02:03 PM
Post#29


UA Admin
Posts: 31,195
Joined: 20-June 02
From: Newcastle, WA


Hmm. What DOES happen?

I put a Stop in the code so that it forces you to step through the Function. Is that what you are seeing?

--------------------
Go to the top of the page
 
GroverParkGeorge
post Aug 20 2017, 02:04 PM
Post#30


UA Admin
Posts: 31,195
Joined: 20-June 02
From: Newcastle, WA


Oh, wait. My Bad. I used the wrong version of Access.
Gimee a minutes to fix that.

--------------------
Go to the top of the page
 
GroverParkGeorge
post Aug 20 2017, 02:15 PM
Post#31


UA Admin
Posts: 31,195
Joined: 20-June 02
From: Newcastle, WA


Again, My apologies. I made the first set of changes using Access 2016.

Here's the 2010 version.
Attached File  Labels_Modified_Access2010.zip ( 343.18K )Number of downloads: 2

--------------------
Go to the top of the page
 
2 Pages V < 1 2


Custom Search
RSSSearch   Top   Lo-Fi    11th December 2017 - 09:42 PM