473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Predefined "Look In" in Find dialog box works, but not 1st time

I use the undermentioned code to find a record in a predefined "Look
In" field:

Private Sub Command137_Click()
On Error GoTo Err_Find_Record_Click
Me.CompanyName.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Find_Record_Click:
Exit Sub
Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click
End Sub

However, the Look In field of the find-record dialog
box is first set a the form name, not the field name as mentioned in
the code (SetFocus).
Though, it happens only when I approached the form for the first time
after I
start Access. Why?

Bart

Jun 8 '06 #1
1 1826
I quit using, or answering questions about "DoMenuItem" some time ago.

If you want to find the record with a particular value in a Control on the
currently-displayed form, you might try:

Me.RecordsetClone.FindFirst "[yourfieldname] = """ & Me.yourcontrolname
& """"
Me.Bookmark = Me.RecordsetClone.Bookmark

(Of course, you must replace yourfieldname with the name of the Field in
your Record and you must replace yourcontrolname with the name of the Field
on your Form.)

(This code assumes the field of interest is text, so the argument of
FindFirst must be in quotation marks. If it is a numeric field, eliminate
two of the string of three quotes, and the entire & """" at the end of the
string.)

(And, a final "of course", the record of interest must exist in the Form's
RecordSource.)

Larry Linson
Microsoft Access MVP


"AA Arens" <ba***********@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
I use the undermentioned code to find a record in a predefined "Look
In" field:

Private Sub Command137_Click()
On Error GoTo Err_Find_Record_Click
Me.CompanyName.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Find_Record_Click:
Exit Sub
Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click
End Sub

However, the Look In field of the find-record dialog
box is first set a the form name, not the field name as mentioned in
the code (SetFocus).
Though, it happens only when I approached the form for the first time
after I
start Access. Why?

Bart

Jun 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alan | last post by:
I am using WindowsXP Pro and ASP. After installed the Frontpage 2003, each time when a script error occur, a "Just-In-Time Debugging" window popup, how to stop it ? I have turn on "Disable...
9
by: Luc Dal | last post by:
Hello, I've serious problem using ASP under WindowsXP sp2. I get the following reply (sorry it's in french) Erreur de compilation Microsoft VBScript error '800a0401' Fin d'instruction...
13
by: Jalal | last post by:
I am trying to use numeric_limits<double>::min() in an MFC application in Microsoft Visual C++.NET 2003. I am having some difficulties here. The following are the parts of a simple program I wrote...
4
by: Zeng Dinghao | last post by:
could anybody explain the term "in memory compilation" to me ? thanks
5
by: Patrick Sannes | last post by:
Hi, At this moment I have one large sourcecode file and want to seperate it into multiple files. When I do so, the app crash after he created 6389 (156794880 bytes total) source files with the...
59
by: Rico | last post by:
Hello, I have an application that I'm converting to Access 2003 and SQL Server 2005 Express. The application uses extensive use of DAO and the SEEK method on indexes. I'm having an issue when...
11
by: Grzesiek | last post by:
Hi I have Main.cpp and Hello.cpp files in my Dev C++ project. Main.cpp #include "Hello.cpp" int main(){ return 0;
4
by: fran7 | last post by:
Hi, from help in the javascript forum I found the error in some code but need help. This bit of code works perfectly, trouble is I am writing it to a javascript function so the height needs to be in...
15
by: David C. Ullrich | last post by:
Luckily I tried it before saying no, that's not how "in" works: True False Is there a reason for the inconsistency? I would have thought "in" would check for elements of a sequence,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.