Solved

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

Posted on 2011-03-04
7
421 Views
Last Modified: 2013-11-05
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
0
Comment
Question by:SteveL13
  • 3
  • 3
7 Comments
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
What is the rowsource of the listbox?
0
 

Author Comment

by:SteveL13
Comment Utility
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;
0
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
I don't understand why you are not getting an error.

Does txtJobN have a default value?
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:SteveL13
Comment Utility
No it does not.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Perhaps you should take a step back and explain exactly what this system is supposed to be doing...?
0
 

Author Comment

by:SteveL13
Comment Utility
When I open the form for a new record entry, the lisbox on that form should be empty.  
0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
Comment Utility
I suspect there is more to this problem than is apparent here.
But a simple fix should be..

WHERE (((tblProjectDetail.JobN)=nz([Forms]![frmProject]![txtJobN], ""))
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now