473,569 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Needing help with If Statement

Hello, I'm having some trouble with my code below. One of my If
statements
causes the code not to work. If I take the If Statement out it runs
fine. I
highlighted the area that I'm having problems with.

If any one could help me with this, I thank you

Private Sub SaveCmd_Click()
Dim cancel As Integer
Dim stdocname As String
Dim stLinkCriteria As String
Dim chk As Object
Dim OneSelected As Boolean

If (DLookup("ReqSt udentIDOpt", "DbOptionsTbl") ) = True Then

If IsNull(StudentI D) Then
MsgBox "Please Enter Your Student ID.", vbOKOnly + vbExclamation
StudentID.SetFo cus
cancel = -1
ElseIf IsNull(Fname) Then
MsgBox "Please Enter Your First Name.", vbOKOnly + vbExclamation
Fname.SetFocus
cancel = -1
ElseIf IsNull(Lname) Then
MsgBox "Please Enter Your Last Name.", vbOKOnly + vbExclamation
Lname.SetFocus
cancel = -1
ElseIf IsNull(TOT) Then
MsgBox "Please a Type of Test", vbOKOnly + vbExclamation
TOT.SetFocus
cancel = -1
----------------------------------------------------------
'This is the part that is giving me problems

ElseIf (TOT.Column(0)) = "Clep Test" Then
If IsNull(ClepName ) Then
MsgBox "Please a CLEP Test", vbOKOnly + vbExclamation
ClepName.SetFoc us
cancel = -1
------------------------------------------------------
Else

If Not (TOT.Column(0)) = "Placement Test" Then
DoCmd.Close

stdocname = "ThankYouFr m"
DoCmd.OpenForm stdocname, , , stLinkCriteria
Else
If (TOT.Column(0)) = "Placement Test" Then
OneSelected = False
For Each chk In Controls

If chk.ControlType = acOptionButton Then

If chk.Value = True Then

OneSelected = True

Exit For
End If
End If

Next
If OneSelected Then
DoCmd.Close

stdocname = "ThankYouFr m"
DoCmd.OpenForm stdocname, , , stLinkCriteria
Else

MsgBox "You must select at least one of the tests"
End If

End If
End If

End If
End If

End If
End Sub

Nov 13 '05 #1
2 1265

<th****@cablesp eed.com> wrote in message
news:10******** **************@ c13g2000cwb.goo glegroups.com.. .
----------------------------------------------------------
'This is the part that is giving me problems

ElseIf (TOT.Column(0)) = "Clep Test" Then
If IsNull(ClepName ) Then
MsgBox "Please a CLEP Test", vbOKOnly + vbExclamation
ClepName.SetFoc us
cancel = -1
------------------------------------------------------

msgbox not good english is problem yes?

***Sherwood Wang MVP***
Nov 13 '05 #2
If (TOT.Column(0)) = "Clep Test" Then
If IsNull(ClepName ) Then
MsgBox "Please enter a CLEP Test", vbOKOnly + vbExclamation, "Name
Required"
ClepName.SetFoc us
cancel = -1
Endif
Endif
Darryl Kerkeslager

"Sherwood Wang" <sh****@waynesw orld.net> wrote in message
news:1097710069 .IRwHqYMoC3Uy8F SVf8aEUQ@terane ws...

<th****@cablesp eed.com> wrote in message
news:10******** **************@ c13g2000cwb.goo glegroups.com.. .
----------------------------------------------------------
'This is the part that is giving me problems

ElseIf (TOT.Column(0)) = "Clep Test" Then
If IsNull(ClepName ) Then
MsgBox "Please a CLEP Test", vbOKOnly + vbExclamation
ClepName.SetFoc us
cancel = -1
------------------------------------------------------

msgbox not good english is problem yes?

***Sherwood Wang MVP***

Nov 13 '05 #3

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

Similar topics

2
1379
by: ABC | last post by:
Which statement on the C# has live-as VB's "With" Statement?
4
5181
by: doodle | last post by:
access 97 can someone tell me the syntax for a with stement for multiple controls? pseudo (doesn't work) With cmbBox1,cmbBox2,cmbBox3 .Visible = False End With
3
2727
by: Ashok Guduru | last post by:
Hi, I'm new to C#. In VB.NET we have With...End With Statement. Often, I need to perform several different actions on the same object. For example, I may need to set several properties or execute several methods for the same object. Private Sub UpdateForm() Button1.Text = "OK"
1
321
by: Gunawan | last post by:
Hi All, When using vb I could use with statement to make access to property/method shorter Dim cmd AS new SqlCommand with cmd.parameters .AddWithValue() .... end with
33
2422
by: =?Utf-8?B?RE9UTkVUR1VZ?= | last post by:
Hello, In vb.net there is a with statement, Is there are similar constructor in c#?
11
1895
by: Nhan | last post by:
Hi, is there equivalent statement in C# as WITH ... END in VB? instead of: frm.dataGridView1.AutoGenerateColumns = true; frm.dataGridView1.DataSource = l_oDataset; frm.dataGridView1.DataMember = this.DataObjectName ; I can write in VB:
2
1395
by: Dmitry Teslenko | last post by:
Hello! I've made some class that can be used with "with statement". It looks this way: class chdir_to_file( object ): .... def __enter__(self): .... def __exit__(self, type, val, tb): ....
2
1390
by: mk | last post by:
Hello, I'm trying to learn how with statement can be used to avoid writing: prepare() try: something_that_can_raise_SomeException() except SomeException, err: deal_with_SomeException finally:
4
1171
by: braver | last post by:
Can open two files in a with statement: with open(src) as readin, open(dst,"w") as writin: # WRONG: comma doesn't work ... -- so that you have transactional safety for two file descriptors? The comma syntax doesn't work, but is there a way, except for with open(src) as readin:
5
2791
by: peppergrower | last post by:
I've been experimenting with the 'with' statement (in __future__), and so far I like it. However, I can't get it to work with a cStringIO object. Here's a minimum working example: ### from __future__ import with_statement import cStringIO teststring='this is a test'
0
7697
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
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...
0
7968
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 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...
0
5219
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...
0
3653
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.