473,395 Members | 1,681 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.

Code: Private Sub help

The following code (VB6) automatically sets ticks or null values for
Check Boxes: 'Pass' and/or 'Resit', depending on the data entered in
the 'ModuleID' and 'Mark' Text Boxes.

'ModuleID' is a Text Box which records the module number of the exam.
Module 1 has a pass mark of 27 and modules 2-7 have a pass mark of 24.

Private Sub Mark_AfterUpdate()
Dim intPassMark As Integer

If Me.[ModuleID] = 1 Then
intPassMark = 27
Else
intPassMark = 24
End If

If IsNull(Me.Mark) Then
Me.Pass = False
Me.Resit = False
Else
Me.Pass = (Me.Mark >= intPassMark)
Me.Resit = Not Me.Pass
End If

End Sub

This works fine:-)

I also have a control 'IVMark', (Text Box which is used to record
secondary marking results), and need it to override the above code if
marks are found to be below the pass mark.

Can you help?
Nov 12 '05 #1
4 4063
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Your question appears to be "How can I have the results of TextBox
IVMark take precedence over the results of TextBox Mark?" Correct?

One method would be to create a module variable that will be set/reset
by TextBox IVMark. E.g.:

Declaration section:

Dim m_blnIVMark_Set As Boolean

- -------

Private Sub IVMark_AfterUpdate()

m_blnIVMark_Set = Not IsNull(Me!IVMark)

... other code that sets Pass/Re-sit values ...

End Sub

Private Sub Mark_AfterUpdate()

If m_blnIVMark_Set Then Exit Sub

... etc. ...

End Sub
Another method: in the IVMark AfterUpdate event you could disable the
TextBox Mark after a valid datum has been entered into the IVMark
TextBox:

If Not IsNull(Me!IVMark) Then
Me!Mark = "" ' Clear the value first
Me!Mark.Enabled = False

' ... continue by setting the Pass/Re-sit values ...

End If

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP+ixtIechKqOuFEgEQJ/KACgyBs9BartRH1JUlEqTR+RQsiVg3QAoIlf
RoAO/j/wrhYdJkAFf2RpgZaf
=pNzT
-----END PGP SIGNATURE-----
Terry wrote:
The following code (VB6) automatically sets ticks or null values for
Check Boxes: 'Pass' and/or 'Resit', depending on the data entered in
the 'ModuleID' and 'Mark' Text Boxes.

'ModuleID' is a Text Box which records the module number of the exam.
Module 1 has a pass mark of 27 and modules 2-7 have a pass mark of 24.

Private Sub Mark_AfterUpdate()
Dim intPassMark As Integer

If Me.[ModuleID] = 1 Then
intPassMark = 27
Else
intPassMark = 24
End If

If IsNull(Me.Mark) Then
Me.Pass = False
Me.Resit = False
Else
Me.Pass = (Me.Mark >= intPassMark)
Me.Resit = Not Me.Pass
End If

End Sub

This works fine:-)

I also have a control 'IVMark', (Text Box which is used to record
secondary marking results), and need it to override the above code if
marks are found to be below the pass mark.

Can you help?


Nov 12 '05 #2
Yes that's correct. I altered my code as follows but this doesn't make
the results of TextBox IVMark take precedence over the results of
TextBox Mark. BTW why the exclamation mark after 'Me' and not a dot?

Option Compare Database

Dim m_blnIVMark_Set As Boolean
Private Sub IVMark_AfterUpdate()

m_blnIVMark_Set = Not IsNull(Me!IVMark)
Dim intPassMark As Integer
If Me.[ModuleID] = 1 Then
intPassMark = 27
Else
intPassMark = 24
End If
If IsNull(Me.IVMark) Then
Me.Pass = False
Me.Resit = False
Else
Me.Pass = (Me.IVMark >= intPassMark)
Me.Resit = Not Me.Pass
End If
End Sub
Private Sub Mark_AfterUpdate()
Dim intPassMark As Integer
If m_blnIVMark_Set Then Exit Sub

If Me.[ModuleID] = 1 Then
intPassMark = 27
Else
intPassMark = 24
End If
If IsNull(Me.Mark) Then
Me.Pass = False
Me.Resit = False
Else
Me.Pass = (Me.Mark >= intPassMark)
Me.Resit = Not Me.Pass
End If
End Sub

Terry
Hash: SHA1

Your question appears to be "How can I have the results of TextBox
IVMark take precedence over the results of TextBox Mark?" Correct?

One method would be to create a module variable that will be set/reset
by TextBox IVMark. E.g.:

Declaration section:

Dim m_blnIVMark_Set As Boolean

- -------

Private Sub IVMark_AfterUpdate()

m_blnIVMark_Set = Not IsNull(Me!IVMark)

... other code that sets Pass/Re-sit values ...

End Sub

Private Sub Mark_AfterUpdate()

If m_blnIVMark_Set Then Exit Sub

... etc. ...

End Sub
Another method: in the IVMark AfterUpdate event you could disable the
TextBox Mark after a valid datum has been entered into the IVMark
TextBox:

If Not IsNull(Me!IVMark) Then
Me!Mark = "" ' Clear the value first
Me!Mark.Enabled = False

' ... continue by setting the Pass/Re-sit values ...

End If

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP+ixtIechKqOuFEgEQJ/KACgyBs9BartRH1JUlEqTR+RQsiVg3QAoIlf
RoAO/j/wrhYdJkAFf2RpgZaf
=pNzT
-----END PGP SIGNATURE-----
Terry wrote:
The following code (VB6) automatically sets ticks or null values for
Check Boxes: 'Pass' and/or 'Resit', depending on the data entered in
the 'ModuleID' and 'Mark' Text Boxes.

'ModuleID' is a Text Box which records the module number of the exam.
Module 1 has a pass mark of 27 and modules 2-7 have a pass mark of 24.

Private Sub Mark_AfterUpdate()
Dim intPassMark As Integer

If Me.[ModuleID] = 1 Then
intPassMark = 27
Else
intPassMark = 24
End If

If IsNull(Me.Mark) Then
Me.Pass = False
Me.Resit = False
Else
Me.Pass = (Me.Mark >= intPassMark)
Me.Resit = Not Me.Pass
End If

End Sub

This works fine:-)

I also have a control 'IVMark', (Text Box which is used to record
secondary marking results), and need it to override the above code if
marks are found to be below the pass mark.

Can you help?

Nov 12 '05 #3
MGF Wrote:Your question appears to be "How can I have the results of
TextBox
IVMark take precedence over the results of TextBox Mark?" Correct?

One method would be to create a module variable that will be set/reset
by TextBox IVMark. E.g.:


Code now works great:-)
I had forgotten to set the event procedure for the IVMark TextBox
AfterUpdate but I got there evantually.

Thanks for your help.

For anyone interested this is a full copy of the code:-

Option Compare Database
Dim m_blnIVMark_Set As Boolean

Private Sub IVMark_AfterUpdate()
m_blnIVMark_Set = Not IsNull(Me!IVMark)
Dim intPassMark As Integer
If Me.[ModuleID] = 1 Then
intPassMark = 27
Else
intPassMark = 24
End If
If IsNull(Me.IVMark) Then
Me.Pass = (Me.Mark >= intPassMark)
Me.Resit = Not Me.Pass
Else
Me.Pass = (Me.IVMark >= intPassMark)
Me.Resit = Not Me.Pass
End If
End Sub
Private Sub Mark_AfterUpdate()
Dim intPassMark As Integer
If m_blnIVMark_Set Then Exit Sub

If Me.[ModuleID] = 1 Then
intPassMark = 27
Else
intPassMark = 24
End If
If IsNull(Me.Mark) Then
Me.Pass = False
Me.Resit = False
Else
Me.Pass = (Me.Mark >= intPassMark)
Me.Resit = Not Me.Pass
End If
End Sub

Terry
Nov 12 '05 #4
Terry wrote:
.... BTW why the exclamation mark after 'Me' and not a dot?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The exclamation point (!) indicates a collection. The default
collection for forms is the Controls collection. Referring to a
control on a form is Me!ControlName.

The period (.) indicates a property. Unfortunately (or fortunately,
depending on your POV) either punctuation mark can be used to refer to
a control.

This controversy has undergone many iterations on this newsgroup -
just search Google.Groups (if you can get the search engine to
recognize ! and . as valid characters).

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP+tzDIechKqOuFEgEQIdrACfWID5msxL9x7APzJ7EIkJ12 stuvgAn3lc
FRAQMfBfarwXPU2RbP9FtUFf
=xExY
-----END PGP SIGNATURE-----

Nov 12 '05 #5

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

Similar topics

2
by: Anita C | last post by:
Hi, How do I associate or map a specific column in a datatable to a particular element present in an xml document - to read into a datatable as well as write from the datatable to the xml element?...
8
by: Greg Fierro | last post by:
I would appreciate any help from anyone with the following: I have an external program (window32 based) that I am executing with the VBA SHELL command. This program produces a text file which I...
6
by: Uttam | last post by:
Hello, I am using the code from Chapter 17 specifically the code from the font frmListFonts in my application. I have taken care to copy all the relevant modules / class modules into the...
2
by: PC User | last post by:
I found some VB code to printout a richtext field and I'm trying to adapt it to MS Access 2000. I think there might be some small changes to make the adaption between VB versions. Also my OS is...
6
by: Mark Reed | last post by:
Hi all, I am trying to learn a little about programming (I know next to nothing so far) and have found some code which hides the toolbars. However, this bit of code is a little too effective and...
9
by: 2D Rick | last post by:
With the help from members in the VB forum I've pieced together code that works in VB6 to create radial text similar to "text on a path" seen in graphics programs.(on a circle only) I use an...
6
by: cj | last post by:
Lets just take this example I'm looking at now. I'm looking at the help screen titled .NET Framework Class Library FolderBrowserDialog Class . It gives an example at the bottom that begins with:...
6
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
4
by: -D- | last post by:
I'm new to .net and just learning c#. I have the following code in vb and want to convert this to c# Public Class PositionData Private strText As String Private strUrl As String Public...
11
by: itgetsharder | last post by:
can anyone help me? code errors! -------------------------------------------------------------------------------- im creating a code for a printer. the question i am trying to answer is : ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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.