Hi Guys,
I am trying to add records from a form which is based on a Table named DAYUSE and at the same time every time I add a record to that table specific data is added to another Table called RECEPTION but that is based on a criteria from a combo box named settlement. I've tried to modify the code but I must have got it wrong somewhere maybe an extra End If or I have to leave out the extra line "ElseIf Me![SETTLEMENT] = "VIVA" Then"
The VBA runs on exit after the last field AMOUNT. Can anyone help me Thanks !!!
Please use CODE TAGS!!!!
	
	
	
		
 I am trying to add records from a form which is based on a Table named DAYUSE and at the same time every time I add a record to that table specific data is added to another Table called RECEPTION but that is based on a criteria from a combo box named settlement. I've tried to modify the code but I must have got it wrong somewhere maybe an extra End If or I have to leave out the extra line "ElseIf Me![SETTLEMENT] = "VIVA" Then"
The VBA runs on exit after the last field AMOUNT. Can anyone help me Thanks !!!
Please use CODE TAGS!!!!
		Code:
	
	
	Private Sub AMOUNT_Exit(Cancel As Integer)
Dim Msg, Style, Title, Response, MyString
Msg = "CONFIRM TRANSACTION YES to Continue NO to Change/Edit Transaction ?"   ' Define message.
Style = vbYesNo + vbInformation + vbDefaultButton1 ' Define buttons.
Title = "FINALIZE SECURITY BOX ENTRY"  ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then  ' User chose Yes.
Dim MyDB As Database, Myset As Recordset
Set MyDB = CurrentDb()
Set Myset = MyDB.OpenRecordset("RECEPTION", dbOpenTable)
If Me![SETTLEMENT] = "CASH" Then
Myset.AddNew
Myset![DEPARTMENT] = Me![DEPT]
Myset![USER] = Me![USER]
Myset![TYPE] = Me![ROOMNO]
Myset![DATE] = Me![DATEDAY]
Myset![IN] = Me![AMOUNT]
Myset.Update
ElseIf Me![SETTLEMENT] = "VIVA" Then
Myset.AddNew
Myset![DEPARTMENT] = Me![DEPT]
Myset![USER] = Me![USER]
Myset![TYPE] = Me![ROOMNO]
Myset![DATE] = Me![DATEDAY]
Myset![IN] = Me![AMOUNT]
Myset.Update
Myset.Close
ElseIf Me![SETTLEMENT] = "VIVA" Then
Myset.AddNew
Myset![DEPARTMENT] = "MONEY IN/OUT"
Myset![USER] = Me![USER]
Myset![TYPE] = "DAY USE CREDIT CARD VIVA"
Myset![DATE] = Me![DATEDAY]
Myset![OUT] = Me![AMOUNT]
Myset.Update
Myset.Close
End If
DoCmd.GoToRecord acDataForm, "DAYUSE", acNewRec
DoCmd.GoToControl "USER"
MyString = "Yes"    ' Perform some action.
    DoCmd.GoToControl "NAME"
    
    MyString = "No" ' Perform some action.
End If
End Sub
	
			
				Last edited by a moderator: