473,385 Members | 1,356 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,385 software developers and data experts.

Need help with FindFirst

Dee
I have a field "TerritoryID" on a subform. It has a Dbl Click event as
follows:

Private Sub TerritoryID_DblClick(Cancel As Integer)

Forms!FmDealer5!Text152 = DealerID '**Retrieves DealerID and
loads unbound Text152 on parent form
Forms!FmDealer5!Text154 = Forms!FmDealer5!DlrId '**Loads current
parent form's DlrId into unbound Text154 on parent form

End Sub

This part works fine
I have unbound Text152 on parent form. It has an 'On Change' event as
follows:

Private Sub Text152_Change()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[DlrId] = 1004" '& [Me!Text152]" ** use after
hard coded number works
'Stop '**Test Only
Me.Bookmark = rs.Bookmark
End Sub

This part never executes. Anyone know why?

My ultimate goal is move to the Text152 record on the parent form,
then have a Command button return me to the previous record.
Nov 13 '05 #1
1 1416
Yes, the Change event fires when the Text of the textbox is changed, not
when the Value is changed. The default property of the textbox is .Value, so
when you don't specify a property, that's the one you get. To use the .Text
property though, the control has to have the focus.

There are a few ways around this.

1) Place the code in the Change event into a separate procedure that you can
call from the Change event or the Double Click event. Call this procedure
from the double click event after you change the value of the control on the
main form. The procedure would be one in the (General) section of the code
window and would be defined as Public.

2) Change the Change event from Private to Public. You can now call it
directly from the subform in the double click procedure.

Example:
Call Me.Parent.Text1_Change

3) Copy and paste the code from the Change event into the Double Click
event, adjusting for the location the code will now be running from (i.e.
subform instead of main form).

--
Wayne Morgan
MS Access MVP
"Dee" <wo********@comcast.net> wrote in message
news:35**************************@posting.google.c om...
I have a field "TerritoryID" on a subform. It has a Dbl Click event as
follows:

Private Sub TerritoryID_DblClick(Cancel As Integer)

Forms!FmDealer5!Text152 = DealerID '**Retrieves DealerID and
loads unbound Text152 on parent form
Forms!FmDealer5!Text154 = Forms!FmDealer5!DlrId '**Loads current
parent form's DlrId into unbound Text154 on parent form

End Sub

This part works fine
I have unbound Text152 on parent form. It has an 'On Change' event as
follows:

Private Sub Text152_Change()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[DlrId] = 1004" '& [Me!Text152]" ** use after
hard coded number works
'Stop '**Test Only
Me.Bookmark = rs.Bookmark
End Sub

This part never executes. Anyone know why?

My ultimate goal is move to the Text152 record on the parent form,
then have a Command button return me to the previous record.

Nov 13 '05 #2

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

Similar topics

2
by: Mark | last post by:
I get "error 3077 Syntax Error (missing operator) in expression" in this expression: Rst.FindFirst "='" & Me!NewSection & "'" when Me!NewSection contains an apostrophe. How can I write the...
5
by: Paul | last post by:
The 2 statements below work perfectly when using them individually. But when I try to concatenate them, they don't. rst.FindFirst " = " & OldQuoteNumber rst.FindFirst " Is Null" Can someone...
106
by: xtra | last post by:
Hi Folk I have about 1000 procedures in my project. Many, many of them are along the lines of function myfuntion () as boolean on error goto er '- Dim Dbs as dao.database Dim Rst as...
6
by: Shyguy | last post by:
Is there a way to use this when entries have an apostrphe in them? Like Joe's Bar and Grill.
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...
2
by: keri | last post by:
Hi everyone, I'm using findfirst in code as below. It searches a query that shows appointment date and account name and should return the account name of the first appointment on each day into...
18
by: Robert Jacobs | last post by:
Please advise... I currently have a Mainform (Customers) and a Subform (Service Requests) with a one to many relationship (one customer, many service requests) with a CustomerID that is unique...
7
by: waltvw | last post by:
I'm using FindFirst method in Access VBA to find a particular record in a recordset. I have 2 search criteria each of which works just fine if used separately as an argument in FindFirst, but NOT in...
2
by: Arnold | last post by:
Hi Gurus, I am getting the error 3420 "object invalid or no longer set" at in the line -- rst.FindFirst "=" & NextPK --in the code below. I simply have a continuous main form that is, by...
0
by: bitstreamer | last post by:
Greetings everybody, I'm trying to UNDERSTAND this code. I've already done lots and lots of debugging sessions and I can confirm that the FIND_NEXT routine is never executed. Every file entry...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.