UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> validate code!!    
 
   
usf89
post Aug 20 2004, 08:39 AM
Post #1

UtterAccess Addict
Posts: 109



I have been using the code below that was so kindly provided to me by a superior UA user:

Private Sub dcheck_num_BeforeUpdate(Cancel As Integer)

' dimension varibles
Dim stCheck As String
Dim stAccount As String

' check there's an account number, else exit
If IsNull(Me.acc_num) Then
Exit Sub
' check there's a check number, else exit
ElseIf IsNull(Me.dcheck_num) Then
Exit Sub
End If

' assign values to our variables
stCheck = Me.dcheck_num.Value
stAccount = Me.acc_num.Value
' perform actual verification
If stCheck = DLookup("[dcheck_num]", "checks", "acc_num='" & stAccount & "'") Then
' notify user check is a dupe
MsgBox "Check number already exist in the system"
' clear all changes
Me.Undo
End If
End Sub


The code is used in a form that contains the following elements:

tied to table "checks"
fields are "acc_num" and "dcheck_num"

The code is used to make sure that two check numbers are not entered for the same account number. The code was working fine, but I realized (after a week) that it was only working on some account numbers. This is crazy to me and I have no explanation. If anyone sees a problem with this code or has alternate suggestions, please help me out, as I have no idea what to do. Thanks in advance for any help!!!!
Go to the top of the page
 
+

Posts in this topic
- usf89   validate code!!   Aug 20 2004, 08:39 AM
- - dilEmma   Re: validate code!!   Aug 20 2004, 09:13 AM
- - babrandt   Re: validate code!!   Aug 20 2004, 09:21 AM
- - Jack Cowley   Re: validate code!!   Aug 20 2004, 09:26 AM
- - usf89   Re: validate code!!   Aug 26 2004, 07:55 PM
- - Jack Cowley   Re: validate code!!   Aug 26 2004, 08:10 PM
- - usf89   Re: validate code!!   Aug 27 2004, 12:46 PM
- - Jack Cowley   Re: validate code!!   Aug 27 2004, 08:05 PM
- - usf89   Re: validate code!!   Aug 31 2004, 02:03 PM
- - Jack Cowley   Re: validate code!!   Aug 31 2004, 03:24 PM


Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 12:29 AM