I quickly put this code together to test if it would disable some of my functions OnChange when my text box (purchase order number) is empty...and if it would enable those functions when I added data to my field. The funny thing is that if you read the code it actually runs in reverse! When my field is null it is suppose to disable...inste ad it enables...Why? So I put my code in to do the opposite of what I want and it works!?!?! I don't mind having my code in logical reverse as long as I get the results I'm looking for...but...I don't get it....???? ;-)
Forwards: (works in reverse and enables features when Null) - Private Sub PurchaseOrderNumber_Change()
-
If IsNull(Me.PurchaseOrderNumber) Then
-
Me.Check107.Enabled = False
-
Me.Check111.Enabled = False
-
Me.Text77.Enabled = False
-
Me.Label119.Visible = True
-
Else
-
Me.Check107.Enabled = True
-
Me.Check111.Enabled = True
-
Me.Text77.Enabled = True
-
Me.Label119.Visible = False
-
End If
-
-
End Sub
Backwards: (disables features when null) - Private Sub PurchaseOrderNumber_Change()
-
If IsNull(Me.PurchaseOrderNumber) Then
-
Me.Check107.Enabled = True
-
Me.Check111.Enabled = True
-
Me.Text77.Enabled = True
-
Me.Label119.Visible = False
-
Else
-
Me.Check107.Enabled = False
-
Me.Check111.Enabled = False
-
Me.Text77.Enabled = False
-
Me.Label119.Visible = True
-
End If
-
-
End Sub
18 2033 FishVal 2,653
Recognized Expert Specialist
Hello.
I suggest you to perform a little experiment - add two controls on the form and in PurchaseOrderNu mber_Change event handler assign PurchaseOrderNu mber.Value property and PurchaseOrderNu mber.Text property values to them.
Regards,
Fish.
@FishVal
Ooook that was interesting.... .So....what is that showing me. A little bizarre, but I have no idea what these results tell me... =-)
"So, where did you learn Access?"
"Learn Access? Who? Me?"
FishVal 2,653
Recognized Expert Specialist @MyWaterloo
I guess it explains why your code behaves in a way you don't expect.
Kind regards,
Fish.
@FishVal
I don't understand how it explains what my code is doing. Why do the two controls behave the way they do? Why does the code work, but in a way that appears to be in reverse? I just don't see how the two controls reveal why the code behaves the way it does.
"I can design a fantastic looking form for you. With buttons and menus and everything."
"What do they do?"
"What?"
"The buttons and menus."
"I have no idea, but they sure look good."
OK. I see that (for whatever reason I don't know) this current process of mine will not work. I guess I'm at a dead end. I was hoping to disable certain features if one of my fields was not filled in i.e. null. =(
FishVal 2,653
Recognized Expert Specialist @MyWaterloo
I think it is quite straightforward .
PurchaseOrderNu mber.Value property is a default property you implicitly invoke when checking condition for enabling/disabling.
This little experiement shows you what this property returns when PurchaseOrderNu mber_Change event fires thus making clear why the code behaves the way it behaves. At the same time value returned by PurchaseOrderNu mber.Text property is , I guess, a more relevant criteria for making decision whether the controls should be enabled or disabled.
Does it make more sense now?
Yes, it kind of makes sense to me. I guess what it really means is that I need to come up with some other way to disable my print buttons if my P.O. number field is null. Any ideas? (Thanks for the lesson.)
mshmyob 904
Recognized Expert Contributor
subscribing just to watch the fun.
cheers,
NeoPa 32,572
Recognized Expert Moderator MVP
Did the values ever get posted?
Fish & the OP seem to be discussing something they can both see but I for one, don't see any values posted (Emperor's clothes! I was never one to try to hide my ignorance so I will always ask the questions).
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Chris |
last post by:
Can anybody help.
I need to read a txt file backwords line by line. Can anybody help me do
this.
Thanks
Chris
|
by: Jay |
last post by:
I have a very large text file (being read by a CGI script on a web server),
and I get memory errors when I try to read the whole file into a list of
strings. The problem is, I want to read the file backwards, starting with
the last line.
Previously, I did:
myfile = open('myfile.txt', 'r')
mylines = myfile.readlines()
myfile.close()
|
by: SK |
last post by:
Hey folks,
I am searching for a string (say "ABC") backwards in a file.
First I seek to the end.
Then I try to make a check like -
do {
file.clear ();
file.get(c);
file.seekg(-2, std::ios::cur);
|
by: Matt DeFoor |
last post by:
I have some log files that I'm working with that look like this:
1000000000 3456 1234
1000000001 3456 1235
1000020002 3456 1223
1000203044 3456 986
etc.
I'm trying to read the file backwards and just look at the first
column. Here's what I've got so far:
|
by: Neil Patel |
last post by:
I have a log file that puts the most recent record at the bottom of the file. Each line is delimited by a \r\n
Does anyone know how to seek to the end of the file and start reading backwards?
| |
by: Adrian |
last post by:
> Hi
>
> I'm lost! so please help me...
>
> I have the following code
>
> I want to simply retrieve all the record that matches the SQL statement, I
> want to know how many records matched and display only one field adata
> from each match but also be able to step forward and backwards?!
>
|
by: Orestis Markou |
last post by:
Hello,
I'm the developer of PySmell ( http://github.com/orestis/pysmell ), a
static analysis/intellisense provider for Python. I am targeting
Python 2.4 code so I'm using the compiler package.
I've been toying around yesterday with the ast module in Python 2.6
and it seems much more cleaner. One thing I don't understand is how
should one handle backwards and forwards compatibility.
|
by: Terry Reedy |
last post by:
Orestis Markou wrote:
My impression is that the 2.6 ast package is quite different from the
2.4 compiler package, but I have not looked at it (in its 3.0 version)
yet. If the 2.4 code you are analyzing is syntactically and sematically
valid as 2.6 code, which I believe is usual, then of course there is no
problem. If it is not, then I would not be sure.
If you want to target 2.3 to 3.0, 2.6 is the only option as far as I
|
by: chromis |
last post by:
Hi,
I'm creating virtual tour of a house, the part I am working on at the moment involves a 360 spin view of the house (a series of 36 flat frames). Each corner of the house has a hotspot so that the user may click to navigate to that corner. I have completed the code to get the house to spin to the correct hotspot when the user clicks on a hotspot but where I'm struggling is working out the correct code so that if you are on position 1 and...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |