I am auto selecting records based on this command button code. It depends on the fExecuteQuery (DAO code) to work properly. I need to replace the DAO classes / references with one that is used by Access 2019 without the DAO 3.6 DLL installed. I do not have clue where to start. Can someone please send me links that will educate me on how to switch out the DAO code.
Code:
Dim strSQL As String
strSQL = "UPDATE Students SET Students.UpdateWorkshop = -1 "
strSQL = strSQL & "WHERE Students.[ID] IN "
strSQL = strSQL & "(SELECT TOP " & CLng(Me.Textbox1) & " [ID] FROM Students As S " ' select # or records based textbox1 value
'strSQL = strSQL & "WHERE (nz(S.UpdateWorkshop, 0) = 0) AND (S.Major In ('BADM', 'PBA')) " ' UpdateWorkshop must No or Null, Major IN BADM or PBA
strSQL = strSQL & "WHERE ((S.Workshop) is null) AND (S.Flightpath)= 'LCB' " ' can't find List of BAD Majorcodes
strSQL = strSQL & "AND (S.Session = " & Val([Forms]![WorkshopsSession]![SessionCombo] & "") & ")"
strSQL = strSQL & "ORDER BY (S.major));"
fExecuteQuery strSQL, dbFailOnError
' reset textbox to blank
Me.Textbox1 = Null
DoCmd.Requery
Code:
unction fExecuteQuery(strQuery As String, _
Optional intOptions As DAO.RecordsetOptionEnum = dbFailOnError, _
Optional blnReturnAuto As Boolean = False, _
Optional pdb As DAO.Database) As Long
Dim db As Database
Dim prm As DAO.Parameter
Dim qdf As QueryDef
Dim rst As DAO.Recordset
If Not pdb Is Nothing Then
Set db = pdb
Else
Set db = CurrentDb
End If
Select Case Left(strQuery, 7)
Case "INSERT ", "UPDATE ", "DELETE "
Set qdf = db.CreateQueryDef("", strQuery)
Case Else
Set qdf = db.QueryDefs(strQuery)
End Select
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next
qdf.Execute intOptions
If blnReturnAuto Then
Set rst = db.OpenRecordset("SELECT @@Identity")
fExecuteQuery = rst(0)
rst.Close
End If
Set prm = Nothing
Set rst = Nothing
Set qdf = Nothing
Set db = Nothing
End Function