473,883 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to move to a specific record after the form is refreshed?

Hi, If I have a primary key, say orderID, after I refreshed the form,
how can i get to that record via VBA.

Nov 13 '05 #1
2 1714
On 21 Jul 2005 13:20:18 -0700, "swingingmi ng" <mi******@gmail .com>

Something like this:
'Assuming a long integer PK
public sub FormMoveToValue (byval strFieldName as string, byval
lngValue as Long, byref frm as Form)
dim rs as dao.recordset
set rs=frm.recordse tclone
rs.findfirst strFieldName & "=" & lngValue
if not rs.nomatch then
frm.bookmark = rs.bookmark
end if
set rs = nothing
end sub

For example in the Northwind sample application, Order form, you could
call this using:
FormMoveToValue "OrderID", orderID, Me


Hi, If I have a primary key, say orderID, after I refreshed the form,
how can i get to that record via VBA.

Nov 13 '05 #2
swingingming wrote:
Hi, If I have a primary key, say orderID, after I refreshed the form,
how can i get to that record via VBA.

You mentioned "Refresh" - the .Refresh method only updates values in the current
recordset. It will not add or delete records to that recordset that were modified after
the recordset was instantiated. That is, a .Refresh will not show new records or remove
ones that were deleted from the recordset. You'll need a .Requery to do that.

The .Requery method will invalidate any Bookmarks.

You'll need to store a unique value from the record, do your .Requery, and then use the
saved unique value to navigate back to the associated record.

**Air Code**:

nKeyID = Me!yourKeyValue


With Me.Recordsetclo ne
.FindFirst yourKeyValue & "=" & nKeyID
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With

'John Mishefske
Nov 13 '05 #3

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

Similar topics

by: Mark | last post by:
I have a working PHP/MySQL application used for data entry. The data entry screen includes a "Save" button. The PHP code for this button looks like this: if (isset($_POST)) { if ($_POST == "") { include ("InsertRecord.inc"); // Insert new record }
by: deko | last post by:
I have a subform datasheet that contains a full year of records sorted by a date field. I'm trying to programmatically move the record selector on the datasheet to the first record that matches a particular date. For example, the user clicks a button and the record selector moves to the first record that matches today's date. I was thinking something like this, but I'm not having any luck: Dim rst As DAO.Recordset Set rst =...
by: sixsoccer | last post by:
I have built a database with a <Mainform> and a <Subform>. My problem is twofold. 1. My subform is set as a continuos form with AllowAddiotions set to NO (ie. a list of Issues to the client on the mainform) 2. To add new issues, a button is used and a pop-up form is used to add an issue with more detail than what's available on the subform. 3. On accepting the new Issue from the pop-up the pop-up closes and you are returned to the...
by: chfran | last post by:
I have a form (continuous) that show me data from a table (not a query). I can only modify and move between the data of the first record. I cannot move to the 2nd, 3rd, or 85th record, only the first. I don't know if I've turned on something unintentionally or what. Any insights? chfran
by: steve | last post by:
Hi all, Come across a situation I cannot figure how to work out. Im relatively new to access but have looked around and tried everything to my knowledge. I've developed an application whereby users load up the database and open a form, this form issues them with work to complete, the work is completed and the next record is offered.
by: planetthoughtful | last post by:
Hi All, I have a C# ASP.NET page that submits back to itself to insert details from a form into a database table. When / if the user refreshes the page (and gets the standard warning that POST data will be resubmitted), the previously submitted record is sumbitted again, and a duplicate record is inserted into the table. In PHP I would have avoided this by submitting the form to a processing page, which would then automatically...
by: Joshua.Buss | last post by:
I am trying to move a record from one linked table to another within access, but I'm a complete beginner to VBA and don't know exactly where to begin. I have an access file that has the two linked tables, which each link to separate SQL databases using separate ODBC connections. I have a form that has a view of table1 and a set of buttons for manipulating the data in database1.
by: MLH | last post by:
I've pretty much always applied a filter to a form to go to a specific record - filtering out all but the desired record. Am looking for code used to move to a specific record when keyfield value is known. This would leave my form in a state that PGUP and PGDN would still navigate up 'n down the dynaset. Seeking simplest methods.
by: jmarcrum | last post by:
I have a table with about 100 records. The user has the ability to click a button on the main form that will open up a "move to the next year" form. A query displays all 100 records on the continuous form. The user can then checkbox which record he/she wants to move to the next year. Here's my question.... How do i check which checkboxes were checked and ONLY move those that were checked? Also, the table that it pulls from is a linked...
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,...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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,...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.