jsummerville
04-12-2017, 07:23 AM
Hello, I am using a button in an unbound form that will use an update sql to place currency fields into a table. I am receiving a error for a datatype mismatch. I am very new to VBA and self taught, Can someone help me? The code is posted below.
Option Compare Database
Option Explicit
Private Sub btnSubmit_Click()
If IsNull(Me.txtFullname) Then
MsgBox "Bro, select a student to adjust!", vbOKOnly
Else
Dim db As Database
Set db = CurrentDb
Dim strUpdateSQL As String
strUpdateSQL = "Update Test_tblFY17_ConvEstimates " _
& "SET Summer_Stipend = '" & Me.txtSumStipend & "' , Summer_Housing = '" & Me.txtSumHousing & "' , Summer_Tuition = '" & Me.txtSumTuition & "' " _
& " WHERE EMPLID = '" & Me.txtStudentID & "';"
Debug.Print strUpdateSQL '<--- PRINT TO IMMEDIATE WINDOW FOR CHECKING
db.Execute strUpdateSQL
End If
End Sub
Option Compare Database
Option Explicit
Private Sub btnSubmit_Click()
If IsNull(Me.txtFullname) Then
MsgBox "Bro, select a student to adjust!", vbOKOnly
Else
Dim db As Database
Set db = CurrentDb
Dim strUpdateSQL As String
strUpdateSQL = "Update Test_tblFY17_ConvEstimates " _
& "SET Summer_Stipend = '" & Me.txtSumStipend & "' , Summer_Housing = '" & Me.txtSumHousing & "' , Summer_Tuition = '" & Me.txtSumTuition & "' " _
& " WHERE EMPLID = '" & Me.txtStudentID & "';"
Debug.Print strUpdateSQL '<--- PRINT TO IMMEDIATE WINDOW FOR CHECKING
db.Execute strUpdateSQL
End If
End Sub