473,385 Members | 1,753 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,385 software developers and data experts.

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("ReqStudentIDOpt", "DbOptionsTbl")) = True Then

If IsNull(StudentID) Then
MsgBox "Please Enter Your Student ID.", vbOKOnly + vbExclamation
StudentID.SetFocus
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.SetFocus
cancel = -1
------------------------------------------------------
Else

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

stdocname = "ThankYouFrm"
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 = "ThankYouFrm"
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 1243

<th****@cablespeed.com> wrote in message
news:10**********************@c13g2000cwb.googlegr oups.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.SetFocus
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.SetFocus
cancel = -1
Endif
Endif
Darryl Kerkeslager

"Sherwood Wang" <sh****@waynesworld.net> wrote in message
news:1097710069.IRwHqYMoC3Uy8FSVf8aEUQ@teranews...

<th****@cablespeed.com> wrote in message
news:10**********************@c13g2000cwb.googlegr oups.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.SetFocus
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
by: ABC | last post by:
Which statement on the C# has live-as VB's "With" Statement?
4
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
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...
1
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
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
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;...
2
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
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...
4
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?...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.