how to create a msgbox from an IF function & checkbox?

Joined
Sep 22, 2008
Messages
1
Reaction score
0
Hi, I've been staring at my screen for the last couple of days and scratching my head with no joy! hopefully there's someone out there that can solve my dilemma!!

I'm using MS Access to support a database of about 7500 records. Its shared across a network from a Win 2003 server, to about 40 users. The database has been in use for the past 4 ish years so i'm not the one who has designed it! Whilst i'm not the best database designer i'm struggling to get by with a little common sense.

I have a table with a checkbox that is used for no other purpose but to create a report to show whether that checkbox is ticked or not. I wish to create a pop-up message / warning box that will appear when a button on a different table is depressed that will say "checkbox is checked!" I thought an IF function might be able to do this - but so far no joy... the code is as follows:
-----------------------------------------------------------------------------------
Option Compare Database

Private Sub Command88_Click()
Dim Dbs As Database, rst As Recordset, rst2 As Recordset
Dim strAlloc As String, curAlloc As Currency, curDif As Currency
Dim curContrib As Currency, curDefAmnt As Currency, CofAVat As Double


Set Dbs = CurrentDb()
Set rst2 = Dbs.OpenRecordset("tblChartofAccs", dbOpenDynaset)
rst2.FindFirst "[ACurn]=" & Me.CtrlType

'MsgBox (rst2![ACDesc])

CofAVat = rst2![ACVatRate]


curDif = (Nz(Me.CtrlAmnt) + Nz(Me.CtrlVATAmnt)) - (Nz(CCur(Me.SumVal)) + Nz(CCur(Me.SumVat)))
curContrib = Forms![frmCustLog_R&PAllocate]![BankAlloc]

If curDif > 0 Then
' Dif Contrib
' 600 300
' 200 300
'
'
Select Case curDif
Case Is < curContrib
curDefAmnt = curDif
Case Is > curContrib
curDefAmnt = curContrib
Case Is = curContrib
curDefAmnt = curContrib
End Select

If db.OpenRecordset("frmCustlog_R&P", "15% Mod") = Yes Then
MsgBox ("Warning 15% fee restriction applies")
End If


strAlloc = InputBox("Enter amount to allocate (Gross)", "", curDefAmnt)
If strAlloc <> "" Then
curAlloc = CCur(strAlloc)
If curAlloc <= curDif Then
If curAlloc > 0 And curAlloc <= curContrib Then
Set rst = Dbs.OpenRecordset("tblCustomer_R&P", dbOpenDynaset)
With rst
.AddNew
'![BankDate] = Forms![frmCustLog_R&PAllocate]![BankDate]
![BankDate] = Date
If CofAVat > 0 Then
![BankDebit] = Round(curAlloc - (curAlloc / 6.714), 2)
![BankDebitVAT] = Round(curAlloc / 6.714, 2)
Else
![BankDebit] = curAlloc
![BankDebitVAT] = 0
End If
![BankCredit] = 0
![BankCaseNo] = Me.CaseNo
If Me.CtrlType = 14 Then
![BankRef] = 5
Else
![BankRef] = 1
End If
![BankAcRef] = Me.CtrlType
![BankXRef] = Forms![frmCustLog_R&PAllocate]![BankTransURN]
.Update
End With
Forms![frmCustLog_R&PAllocate]![BankAlloc] = Forms![frmCustLog_R&PAllocate]![BankAlloc] - curAlloc
If Forms![frmCustLog_R&PAllocate]![BankAlloc] = 0 Then
MsgBox ("Allocation complete. Return to R&P main form")
End If

Forms![frmCustLog_R&PAllocate]![frmCustLog_R&PControl].Form.Refresh
Else
MsgBox ("The amount of allocation must be equal or less than amount left to allocate")
End If
Else
MsgBox ("This allocation will exceed the control amount. Please check your input.")
End If
End If
Else
MsgBox ("You cant allocate to this account.")
End If

End Sub
--------------------------------------------------------------------------
The section i've entered is highlighted in pink. If anyone can suggest as to why this may not work it would be greatly appreciated!

Many Thanks

Phil Robst
------------
p.s. this is the first time i've posted to a forum so let me know if i've missed anything!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top