Solved

question on search in a form

Posted on 2014-02-19
2
281 Views
Last Modified: 2014-02-19
Hello,
attaching database-
when you open it -  you will see form [frmSearch]
I use this code in unbound textbox in header:*****************************
Private Sub txtOne_AfterUpdate()
If Nz(DLookup("[TTID]", "tbl1", "[TTID]=" & Chr(34) & Me.txtOne & Chr(34)), "") > "" Then
       Me.Requery
       Me.Computers.SetFocus      
Else
MsgBox "TTID does not exit!"
Me.txtOne = ""
Cancel = True
End If
End Sub
************************************
I have a database where I use this and am able to have form open with just the unbound text box and then user enters TTID number- hits enter and then the form displays the full form with [qty], [so#], and [TTID]-

NOW- when open the form and a the query the form is based on - brings up an [enter parameter form] -

can you see what i am not doing or doing wrong?
thank you
Example-A1.accdb
0
Comment
Question by:davetough
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39870450
Generally when you get this error it's because you're asking Access for a field that does not exist, so check your table and field names, as well as Control names, for correct spelling. Also, remove the square brackets in the first argument:

If Nz(DLookup("TTID", "tbl1", "[TTID]=" & Chr(34) & Me.txtOne & Chr(34)), "") > "" Then
0
 

Author Closing Comment

by:davetough
ID: 39870570
thanks!! named form incorrectly
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

863 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

21 Experts available now in Live!

Get 1:1 Help Now