Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

Listbox doesn't open to a new (blank) record when form opens for new record input

I have a form that opend for a new record input.  On this form is a listbox.  But when the form opens the listbox is not empty and should be.  What is wrong with my code... ?...

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmProject"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.GoToRecord , , acNewRec
    Forms!frmProject.List136.Requery
    Forms!frmProject.txtDrops = ""
    Forms!frmProject.txtJobN.SetFocus

Exit_Command12_Click:
    Exit Sub

Err_Command12_Click:
    MsgBox Err.Description
    Resume Exit_Command12_Click
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

What is the rowsource of the listbox?
Avatar of SteveL13

ASKER

Is a query... Here is the SQL code:

SELECT Format([tblProjectDetail].[DetailID],"0") AS [Drop], tblProjectDetail.JobN, Format([tblProjectDetail].[Qty],"0") AS Qty, tblProjectDetail.DropDueDate AS [Due Date], tblProjectDetail.Complete, tblProjectDetail.Billed, tblProjectDetail.Name, tblProjectDetail.Cancelled
FROM tblProjectDetail
WHERE (((tblProjectDetail.JobN)=[Forms]![frmProject]![txtJobN]))
ORDER BY tblProjectDetail.Complete DESC , tblProjectDetail.DropDueDate;
I don't understand why you are not getting an error.

Does txtJobN have a default value?
No it does not.
Perhaps you should take a step back and explain exactly what this system is supposed to be doing...?
When I open the form for a new record entry, the lisbox on that form should be empty.  
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial