I have a simple program in VB which uses DAO to connect to and Access 97 database.
I need to do a check on one column of records which contains certain amounts of money, so this sum doesn't go further than I want. So when the user wants to add more transactions, the program tells him that he can't input any more money amounts because he/she has already filled the daily permission
The table where I get the column is called "listici" and the row is called "ulog". In the table "parametri" are some other parameters along with the row "daycheck" which contains variable where program checks sum against daycheck, if sum is bigger than daycheck's value, he should display the message.
Here's the code when customer clicks the button for new transaction:
Private Sub Command4_Click(Index As Integer)
Select Case Index
Case 0 'new
'check for daily revenue limit
If Data1.RecordSource = "SELECT DISTINCT SUM(ulog) WHERE storno = " & False & "" >= parametri("daycheck") Then
MsgBox "Your transactions are over limits", vbCritical + vbOKOnly
Unload MDIForm1 'close program
Option1.Value = True
Option2.Value = False
Option3.Value = False
DBGrid2.Enabled = False
Command4(0).Enabled = False
Command4(1).Enabled = False
Command2.Enabled = False
Command4(3).Enabled = True
Command4(5).Enabled = True
Command4(4).Enabled = False
Check1.Enabled = True
Thanks in advance for your kindness and help !