Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Sub updateTable()
Dim strSql As String
Dim theYear As Integer
Dim thePeriod As Integer
Dim theCostingDate As Date
theYear = Me.cmboYear
thePeriod = Me.cmboPeriod
theCostingDate = Me.cmboCostingDate
strSql = "UPDATE table2 SET table2.Year = " & theYear
strSql = strSql & " , table2.Period = " & thePeriod
strSql = strSql & " , table2.CostingDate = " & theCostingDate
strSql = strSql & " WHERE table2.Year Is Null AND table2.Period Is Null"
DoCmd.RunSQL strSql
End Sub
Private Sub Command8_Click()
Call updateTable
End Sub
Public Sub updateTable()
Dim strSql As String
Dim theYear As Integer
Dim thePeriod As Integer
Dim theCostingDate As Date
theYear = Me.cmboYear
thePeriod = Me.cmboPeriod
theCostingDate = Me.cmboCostingDate
If Not DCount("Period", "table2", "Year = " & theYear & " AND Period = " & thePeriod) = 0 Then
MsgBox "Period and Year already exist"
Exit Sub
End If
strSql = "INSERT INTO table2 ([Year],[Period],[CostingDate])"
strSql = strSql & "SELECT " & theYear & ", " & thePeriod & ", " & theCostingDate
'Debug.Print strSql
DoCmd.RunSQL strSql
End Sub