473,395 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

if statment problem

Simple question: If Me.strPosttype ="ACCT" or Me.cboDocType.Text.Trim ="M"
, It should ignore the checking point .However, I found that I can do it.

If (Me.cboDocType.Text.Trim) <> "M" Or Me.strPostType <> "ACCT") Then
.........checkingpoint
end if

Now, I change my syntax into the following, the problem is solved. but
anyother simple way to do that.
If (Me.cboDocType.Text.Trim) <> "M" then
IF Me.strPostType <> "ACCT") Then
.........checkingpoint
end if
end if
Nov 21 '05 #1
4 833
Hi,

You should use and instead of or because you want both conditions to
be true.

If (Me.cboDocType.Text.Trim) <> "M" And Me.strPostType <> "ACCT") Then
Ken
-----------------------------
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Simple question: If Me.strPosttype ="ACCT" or Me.cboDocType.Text.Trim ="M"
, It should ignore the checking point .However, I found that I can do it.

If (Me.cboDocType.Text.Trim) <> "M" Or Me.strPostType <> "ACCT") Then
.........checkingpoint
end if

Now, I change my syntax into the following, the problem is solved. but
anyother simple way to do that.
If (Me.cboDocType.Text.Trim) <> "M" then
IF Me.strPostType <> "ACCT") Then
.........checkingpoint
end if
end if

Nov 21 '05 #2
Agnes,
If (Me.cboDocType.Text.Trim) <> "M" then
IF Me.strPostType <> "ACCT") Then
.........checkingpoint
end if
end if


The syntax above is
If Me.cboDocType.Text.Trim <> "M" AndAlso Me.strPostType <> "ACCT" Then

Not Or

I hope this helps,

Cor
Nov 21 '05 #3
"Agnes" <ag***@dynamictech.com.hk> schrieb:
Simple question: If Me.strPosttype ="ACCT" or Me.cboDocType.Text.Trim
="M" , It should ignore the checking point .However, I found that I can do
it.


NOT(A OR B) <-> NOT(A) AND NOT(B)

<-> ... logically equivalent.

=>

\\\
If Me.strPosttype <> "ACCT" AndAlso Me.cboDocType.Text.Trim() <> "M" Then
...
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Simple question: If Me.strPosttype ="ACCT" or
Me.cboDocType.Text.Trim ="M" , it should ignore the
checking point.


How about this?

If Me.strPosttype = "ACCT" _
Or Me.cboDocType.Text.Trim = "M" _
Then
' Ignore the checking point
' Do Nothing - (my favourite comment)
Else
' checking point
End If

HTH,
Phill W.
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: e_AK_05 | last post by:
I have a question and I can't figure out how to do it. I have a select statment : SELECT table1.* AS table1.*, table2.* AS table2.* FROM table1, table2 WHERE 1 this does not work...for me at...
1
by: Joe Saliba | last post by:
Hi, would like to know how to write a crosstable select statment in sql server2000 where having: - ItemNumber, ItemDescription, ItemColor, ItemSize as rows - Stores as columns - Qty * Netttc...
9
by: Appel | last post by:
Hallo i have a problem to add to string with a SQL statement. My Table : Tablename NAMES: | Name1 | Name2 | Name3 | John Meyer I search for a SQL statment that update Name3.
1
by: Maria | last post by:
Hello I have not used db2 in a long time, and I have this very long insert script, which is giving me an error of duplicated inserts. My question is how can I put something in the statment so...
1
by: Me, Myself, and I | last post by:
First off, i apologize if my terminology is off... I am currently in a project that is basically a front-end to a database. In coding this, I am taking into account that it has the *potential*...
5
by: orencs | last post by:
Hello, I am using Microsoft.Practices.EnterpriseLibrary.Data. I am running the following sqlCommand = "SELECT var1 FROM table1 WHERE var2 IN (4,5,6) ; SELECT var3 FROM table2 WHERE var2 IN...
5
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used...
4
by: huzzaa | last post by:
I am using a switch statement that will decide from a random number what message to display. I want the random number to be between 0 and 100 and then if the number is say between 1 and 10 to...
1
by: zeebiggie | last post by:
Good morning I have a form with the controls in the insert statment below. table1 has an Auto increment primary key hence is omitted in the insert statment and form. Am getting the error It didnt...
1
by: shivendravikramsingh | last post by:
hello friends, actually i have a problem in using conditional statement in ajax function i m tring to describe my problem properly,what i want when i select a value form a combo its vlue is passed...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.