473,788 Members | 3,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How To Set Focus to a Specific Record?

I have a button on "Form A" in the right margin of every record in my
recordset. When you click on a button, a dialog box ("Form B") pops
up that gives more details about that particular record.

The problem is that when I close the dialog, the cursor jumps to the
beginning of the recordset on "Form A". I want it to go back to the
record where I pressed the button.

What's the best way to set the focus to a particular record when
closing "Form B"?
Nov 13 '05 #1
3 5285
The default behavior is that the current record will stay currrent.

The fact that it is jumping back to the first record suggests that you have
some code or macro that is causing the form to Requery. Remove that code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"David Altemir" <al********@yah oo.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
I have a button on "Form A" in the right margin of every record in my
recordset. When you click on a button, a dialog box ("Form B") pops
up that gives more details about that particular record.

The problem is that when I close the dialog, the cursor jumps to the
beginning of the recordset on "Form A". I want it to go back to the
record where I pressed the button.

What's the best way to set the focus to a particular record when
closing "Form B"?

Nov 13 '05 #2
I did have a DoCmd.Requery statement in the OnClose event of Form B
and so I took it out as you suggested. Still jumps to the start of
the recordset though and I can find any other places where a requery
is being issued after the transition to Form A.

Is there a way to force the focus back to the orignal record?

The default behavior is that the current record will stay currrent.

The fact that it is jumping back to the first record suggests that you have
some code or macro that is causing the form to Requery. Remove that code.
"David Altemir" <al********@yah oo.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
I have a button on "Form A" in the right margin of every record in my
recordset. When you click on a button, a dialog box ("Form B") pops
up that gives more details about that particular record.

The problem is that when I close the dialog, the cursor jumps to the
beginning of the recordset on "Form A". I want it to go back to the
record where I pressed the button.

What's the best way to set the focus to a particular record when
closing "Form B"?

Nov 13 '05 #3
If you know the primary key value of the record you are looking for, you can
FindFirst on the form's RecordsetClone, but it would be better to track down
why the problem occurred if possible.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"David Altemir" <al********@yah oo.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
I did have a DoCmd.Requery statement in the OnClose event of Form B
and so I took it out as you suggested. Still jumps to the start of
the recordset though and I can find any other places where a requery
is being issued after the transition to Form A.

Is there a way to force the focus back to the orignal record?

The default behavior is that the current record will stay currrent.

The fact that it is jumping back to the first record suggests that you
have
some code or macro that is causing the form to Requery. Remove that code.
"David Altemir" <al********@yah oo.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
>I have a button on "Form A" in the right margin of every record in my
> recordset. When you click on a button, a dialog box ("Form B") pops
> up that gives more details about that particular record.
>
> The problem is that when I close the dialog, the cursor jumps to the
> beginning of the recordset on "Form A". I want it to go back to the
> record where I pressed the button.
>
> What's the best way to set the focus to a particular record when
> closing "Form B"?

Nov 13 '05 #4

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

Similar topics

9
48967
by: Randell D. | last post by:
Folks, I'm working on a contact name/address database whereby a slimed down list is shown in the main window. When a record is selected, the complete record is displayed in a new window via a call to window.open As opposed to closing and re-opening new windows, I would prefer that when the user is finished reading the complete record, they can click a link whereby the main window is sent in to focus.
17
3863
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a record to the subform (based on the value of the combo box) and requeries the subform control. I want the focus to return to the combo box on the main form when it's done, but I can't get it to do so if the user enters a value and presses Enter...
1
5053
by: cider123 | last post by:
I've tried working with the SelectedIndices and Items.Selected attributes to get the problem to go away, but not having any luck. Questions I have are: 1) How do you move (using code) the focus Rectangle when your Selected Index changes ? 2) If there are no selected rows, can that focus rectangle be removed? 3) What other quirks exist in this simple example I might need to code for ?
1
30489
by: kaeldowdy | last post by:
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
5
5272
by: LabGeek | last post by:
I have an Access application that I have created that collects data from a scanner and from a weighting scale. The data from the scanner are unique identifiers (barcodes) and the scanner is connected as a keyboard wedge. The data from the scale are weights and are collected by com port using MScomm32.ocx. A user will scan a barcode into a text box (linked to a table field) and then weight a sample. The weight will be collected from...
16
3556
by: google | last post by:
In a continuous form the following code is under a button in the form header. In Access 2003 and earlier, this goes to a new record, then adds relevant data to that new record. DoCmd.GoToRecord , , A_NEWREC If <some codeThen = "CA002" Else
7
1819
by: =?Utf-8?B?dmJ0cnlpbmc=?= | last post by:
I am using a switch statement, to check for valid user hours. If the hours control is blank, I want to place the cursor back to the hours control for the user. The following code does NOT work: switch (txtHours.Text) { case "": MessageBox.Show("No hours entered.\nYou must enter hours
1
2477
by: stuart | last post by:
I have a list of records in a subform that a user can either edit or delete. This is an unbound form. If the user deletes a record, I want to refresh the form, and then position the cursor on the next record on that subform. This seems like that this should be a fairly easy thing to accomplish, but I cannot get it to reposition the cursor on the next record. The following is my code segment: Any help would be greatly appreciated!!! ...
2
2773
by: angi35 | last post by:
I hope this is an easy question for someone out there. In Access 2000…I have a MainForm with a tab control (MAIN TABS) with 7 tabs. Within each tab is a SubForm. Within each SubForm is a tab control (TabCtl0) with 2-6 tabs. Within each TabCtl0, each tab contains a SubSubForm. Each record in the MainForm has an ID Number; the SubForms are bound to that ID Number, and the SubSubForms are bound to that ID Number in the SubForms. In order...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.