Hi,
Im trying to use the following code to check if the relevant field on a form has been completed before updating the subform. If the field has no value then it should display a message box asking the user to return to the form and provide one. Though when I attempt to use the procedure it gives me the runtime error that the statement is invalid outside of type block. Im not sure how to fix this, someone please helllpppp
Private Sub DebitUpdate_Click()
On Error GoTo Err_DebitUpdate_Click
Dim DebitAcc As String
Dim DebitAmnt As Currency
Dim DebitDescr As String
Dim Analysis0 As String
Dim Analysis1 As String
Dim Analysis2 As String
Dim Analysis3 As String
Dim Analysis4 As String
Dim Analysis5 As String
Dim Analysis6 As String
Dim Analysis7 As String
Dim Analysis8 As String
Dim Analysis9 As String
Dim T0 As String
Dim T1 As String
Dim T2 As String
Dim T3 As String
Dim T4 As String
Dim T5 As String
Dim T6 As String
Dim T7 As String
Dim T8 As String
Dim T9 As String
Dim localConnection As ADODB.Connection
Dim strSql As String
Dim rs As ADODB.Recordset
Dim Message As String
T0 = "T0"
T1 = "T1"
T2 = "T2"
T3 = "T3"
T4 = "T4"
T5 = "T5"
T6 = "T6"
T7 = "T7"
T8 = "T8"
T9 = "T9"
Set localConnection = CurrentProject.AccessConnection
localConnection.CursorLocation = adUseClient
Set rs = New ADODB.Recordset
DebitAcc = Forms!Main!DebitAccount
If IsNull(DebitAcc) Then
Message = "A Debit Account number has not been selected please return to the form and choose an account"
MsgBox(Message, [vbOKOnly], [Missing Account Number]) As VbMsgBoxResult
Resume Exit_DebitUpdate_Click
End If
Thanks
Andi
Im trying to use the following code to check if the relevant field on a form has been completed before updating the subform. If the field has no value then it should display a message box asking the user to return to the form and provide one. Though when I attempt to use the procedure it gives me the runtime error that the statement is invalid outside of type block. Im not sure how to fix this, someone please helllpppp
Private Sub DebitUpdate_Click()
On Error GoTo Err_DebitUpdate_Click
Dim DebitAcc As String
Dim DebitAmnt As Currency
Dim DebitDescr As String
Dim Analysis0 As String
Dim Analysis1 As String
Dim Analysis2 As String
Dim Analysis3 As String
Dim Analysis4 As String
Dim Analysis5 As String
Dim Analysis6 As String
Dim Analysis7 As String
Dim Analysis8 As String
Dim Analysis9 As String
Dim T0 As String
Dim T1 As String
Dim T2 As String
Dim T3 As String
Dim T4 As String
Dim T5 As String
Dim T6 As String
Dim T7 As String
Dim T8 As String
Dim T9 As String
Dim localConnection As ADODB.Connection
Dim strSql As String
Dim rs As ADODB.Recordset
Dim Message As String
T0 = "T0"
T1 = "T1"
T2 = "T2"
T3 = "T3"
T4 = "T4"
T5 = "T5"
T6 = "T6"
T7 = "T7"
T8 = "T8"
T9 = "T9"
Set localConnection = CurrentProject.AccessConnection
localConnection.CursorLocation = adUseClient
Set rs = New ADODB.Recordset
DebitAcc = Forms!Main!DebitAccount
If IsNull(DebitAcc) Then
Message = "A Debit Account number has not been selected please return to the form and choose an account"
MsgBox(Message, [vbOKOnly], [Missing Account Number]) As VbMsgBoxResult
Resume Exit_DebitUpdate_Click
End If
Thanks
Andi