Code:
strSQL = "SELECT TOP " & count & " Unique_ID from Main_Table ;"
But before you do that you may want to do some validation on the user input.
EDIT:
Code:
Public Function SQL() '<-- function but doesn't have a return value
On Error GoTo ErrHandler
Dim count As Variant
count = InputBox("How many records do you want to download?", "Download")
If Not IsNumeric(count) Then
' this should quit the function of a number isn't input by the user
Err.Raise 1001, , "Input requires a numeric value."
End If
count = CInt(count)
If count < 1 Or count > 1000 Then
Err.Raise 1002, , "Input must be between 1 and 1000."
End If
Dim db As DAO.Database
Dim qdef As DAO.QueryDef
Dim strSQL As String
strSQL = "SELECT TOP " & count & " Unique_ID FROM Main_Table ;"
Set qdef = db.QueryDefs("Pull_Query")
qdef.SQL = strSQL
qdef.Close
DoCmd.OpenQuery "Pull_Query", acViewNormal
ExitHandler:
Set qdef = Nothing
Set db = Nothing
Exit Function
ErrHandler:
MsgBox Err.Description, vbExclamation, "Error in 'SQL' Sub: #" & Err.Number
Resume ExitHandler
End Function