Sorry, but I have one more question. Your button opens the query, which is unusual. Usually, one would open a form or report based on the query. Are your users editing the query directly?
Anyway, here is the modified code. This is not exact;
Private Sub cmdOpen_Click()
On Error GoTo Err_cmdOpen_Click
Dim stDocName As String
Dim strSQL as string
Dim strNumFrom as string
Dim strNumTo as string
Dim datProcDate as date
Dim qdf as QueryDef
'SET UP YOUR DEFAULT VALUES
If me![txtClientNumberFrom] ="" then
strNumFrom= YourDefaultValue
else
strNumFrom = me![txtClientNumberFrom]
end if
'SAME LOGIC FOR THE OTHER TWO PARAMETERS.
strSQL = "SELECT span_ip_cl_acc_hold_trans.cl_number
FROM ...
WHERE ((span_ip_cl_acc_hold_trans.cl_number) Between " & strNumFrom & " And " & strNumTo & " And ((span_ip_cl_acc_hold_trans.proc_date)=" & datProcDate & "

);
set qdf = currentdb.createQueryDef("Extract",strSQL)
DoCmd.OpenQuery "Extract", acNormal, acEdit
Exit_cmdOpen_Click:
Exit Sub
Err_cmdOpen_Click:
MsgBox Err.Description
Resume Exit_cmdOpen_Click
End Sub
I'm not positive that you can open the Extract query without saving the qdf first. This should give you a start though.
Kathryn