473,399 Members | 3,106 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,399 software developers and data experts.

Set focus to particular record using Continuous Forms

This one is stumping me!

I have a Form/Subform arrangement. The main form is set as a Single
Form and the sub form is set as Continuous Forms.

On the Form_AfterUpdate event of the subform, I run some code that
affects the main form which forces focus *away* from the subform and
puts it to the main form.

I need to keep focus on the subform when the code in the
Form_AfterUpdate event finishes. Sounds simple enough, right!? I
tried a Me.CtrlName.SetFocus in the subform after I'm done running my
code. However, in continuous forms, it defaults back to the *first*
row. I'm wanting to set focus back to a specific row/instance in the
subform.

I tried DoCmd.RunCommand acCmdRecordsGoToLast and the like, but I want
to get focus to where I last left off, not the first, last, new, etc.
record.

I do have a hidden unique identifier if that would be used as part of
the solution.

Any thoughts? If you need more info, let me know!

Thanks,
Kael

Mar 30 '06 #1
1 30377
Well, I think I got it figured out. It was easier than I thought...

Form_AfterUpdate()
Dim lngPosition as Long

lngPosition = Me.CurrentRecord ' capture index position of record
currently selected

' *** do my code where my subform loses focus to parent form ***

Me.ControlName.SetFocus ' go back to sub form

Me.Form.Recordset.Move lngPosition ' navigate back to original
record position
End Sub

I still have some debugging to be sure its fine tuned correctly to
account for all possible situations, but this got me 90% of the way
there. I guess it was easier than I thought (Me.CurrentRecord and
Me.SelTop didn't jump out at me at first!)

Thanks!

Mar 30 '06 #2

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

Similar topics

4
by: Skully Matjas | last post by:
I am using the following code (created by the wizard) to allow to bring my form to a particular entery. But when I edit the entery (ex: put new information into a blank cell), it puts that record...
2
by: aaj | last post by:
Hi all I have a small but rather annoying problem with continuos forms, and am wondering if anyone can suggest a method of getting over it. The front end is Access 2002 with the BE being SQL...
3
by: Mark | last post by:
Hi there, I have a subform, set as a continuous form. When a user selects a particular record in that subform, how can I make that particular record stand out (color or font change, size, etc) from...
2
by: Cro | last post by:
Dear Access Developers, I am developing a form with 'default view' set to "continuous forms". I am suffering with a problem I can't yet see a solution too. Each record has many fields. Two...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
5
by: Armando | last post by:
I recently saw the tail end of a "Continuous forms" discussion, but not enough was available to see if this will be a PITA repeat question. Sorry if it is. On a form with its Default View...
0
by: Steve Jorgensen | last post by:
One thing that makes Access so useful rapid development tool is the seemless way it links user interfaces to data storage. That is also one of its most maddening weaknesses, since Access doesn't...
4
by: neoman007 | last post by:
I have a form (frm_approval) which is based on a query (qry_unapproved). The query queries a table (tbl_total) for records that are unapproved and shows these records in (frm_approval) so the...
2
by: rajvbprogramer | last post by:
here is my problem. i have two records. one containing 20 records and second containing 30 records. now i want the recordcount property to use and go to the 21 record. i m calculating the...
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: 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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.