Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-03-04
7
Medium Priority
?
474 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 35037838
What is the rowsource of the listbox?
0
 

Author Comment

by:SteveL13
ID: 35038039
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
ID: 35038926
I don't understand why you are not getting an error.

Does txtJobN have a default value?
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:SteveL13
ID: 35038950
No it does not.
0
 
LVL 74

Expert Comment

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

Author Comment

by:SteveL13
ID: 35096225
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 2000 total points
ID: 35096651
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

730 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