I have some VBA Code that is doing a Select TOP statement, where it takes the TOP number from a number that the user is prompt for on a form.
For some reason, it is selecting all the records not just the TOP 10.
I have included the VBA Code in the Code section.
Can someone please tell me what the issue might be?
Private Sub cmdAssign_Click()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim lngTop As Long
Dim strSQL As String
Set db = CurrentDb
Set qdf = db.CreateQueryDef("qryWorkAssigned")
lngTop = CLng(InputBox("Enter Amount to Assign"))
strSQL = "SELECT TOP " & lngTop & " numDay, numDay, txtAssignedTo, txtAssignedBy, dtmDateAssigned, numID, txtPmtTyp, txtSuff FROM [qryUnPro] ORDER BY numID"
qdf.SQL = strSQL
DoCmd.RunSQL "UPDATE qryWorkAssigned SET qryWorkAssigned.txtAssignedBy = [Enter Your User ID], qryWorkAssigned.txtAssignedTo = [Enter User ID Being Assigned], qryWorkAssigned.dtmDateAssigned = [Enter Today's Date]"
'Refresh MAPD Form