473,803 Members | 3,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open a 2nd form from a 1st form and keep the same rs and current record

I would like to open a columnar form (so I can see all the details)
from a datasheet form (so I can see what is there) but keep the same
recordset and current record.

I can do the recordset set part (stlinkcriteria ) - but how do I have
the new form open on the record that was current in the datasheet form?

I don't want to filter to the current record when the 2nd form opens -
I would like to be able to keep the whole rs and be able to go back and
forward to the other records.

Nov 13 '05 #1
1 2968
"4004" <m.********@ntl world.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
I would like to open a columnar form (so I can see all the details)
from a datasheet form (so I can see what is there) but keep the same
recordset and current record.

I can do the recordset set part (stlinkcriteria ) - but how do I have
the new form open on the record that was current in the datasheet form?

I don't want to filter to the current record when the 2nd form opens -
I would like to be able to keep the whole rs and be able to go back and
forward to the other records.

The trick to this, is to write code in the second form's open event. This
code assumes that there is a table of contacts with a primary key ConID
which is a long integer (if the primary key is text then the code needs to
be adjusted slightly).
Private Sub Form_Open(Cance l As Integer)

On Error GoTo Err_Handler

Dim strOpenArgs As String

strOpenArgs = Trim(Nz(Me.Open Args, ""))

If Len(strOpenArgs ) > 0 Then

Cancel = True

With Me.RecordsetClo ne

.FindFirst "ConID=" & strOpenArgs

If Not .NoMatch Then
Me.Bookmark = .Bookmark
Cancel = False
Else
MsgBox "Cannot locate contact no: " & strOpenArgs, _
vbExclamation, _
"Record location error"
End If

End With

End If

Exit_Handler:
Exit Sub

Err_Handler:
MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler

End Sub
Once this code is in there, you can then open the contacts form at a
particular record by calling
Docmd.OpenForm "frmContact",,, ,,,"203"
Where "203" is an example ContactID, which, of course, would come from the
first form in your case.
If you don't supply a contact id, the form simply opens as normal. If you
do, then it will only open if it locates that record.

Nov 13 '05 #2

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

Similar topics

4
25033
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or less complex technical calculations, several input variables. I would like to equipp the starting panel with the usual New, Open, Save, Save As, Close etc. menus (like in Excel, or Word, etc.) What is the best way to accomplish Save, or Save As?...
55
4678
by: Steve Jorgensen | last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of multiple parameters in a Property Let procedure to pass dimensional arguments on the basis that, although it works, it's not obvious how the code works if you don't know the intricacies of the Property Let/Get syntax. Likewise, I dislike (and code to minimize the use of) the VB/VBA syntax of returning a value by referring to the function name as if it were a...
4
3165
by: Dalan | last post by:
I presume that using an open recordset method is the preferred method of accomplishing what I'm trying to do. Of course, if there are other options that would work, feel free to share them. I need to provide a means of scanning one field for all records and to trigger a message upon opening the form for alerting a user that maintenance activities need to be promptly performed. The recordset does not necessarily have to be used for any...
1
3072
by: SorboPos | last post by:
Hi. I have a form with continuous forms and a data entry section in the header of the form. (I.e. all transactions show in the main form area like a data sheet and the data for the highlighed tran is entered or edited in the header.) Record source for the form is a query that is sorted by tran date. Records are sorted by date of transaction ascending.
8
12119
by: Zlatko Matiæ | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the combobox. What is the solution? Thank you in advance.
6
1691
by: Esteban404 | last post by:
I'm trying to create a preview shot of a record being edited, so I want to take the current state and pass it to a instance of a form I have. I've tried to create a dataView and pass that, but it has been failing. System.Data.DataRowView drvCurrent; System.Data.DataView dvNew; dvNew = new System.Data.DataView(); drvCurrent = (System.Data.DataRowView)this.ds1.Message; dvNew.Table = this.ds1.Message; dvNew.RowFilter="MessageID = '"...
1
4787
by: NumberCruncher | last post by:
Hi All, I am struggling with setting up my first system of tables, forms,and reports, and could use your help! I am setting up a database to keep track of the production of a produced item. The item is a panel, with a specific texture. There are standard panels that are then produced in a limited number of specific textures. The number of panels/project varies, so I keep track of the actual number of panels per project with the count:...
1
1808
by: cbanks | last post by:
Hello Ladies/Gents, im in need of some serious help here.. I have a tool that allows users to view information on a form and make changes to recordsets. This tool has buttons that allow a user to cruise to the next or previous record. The problem i am having is when they click next record it moves to the next record and checks to see if the record is stamped as open. If it is stamped as open, meaning opened by another user, then it will...
9
3409
by: vanlanjl | last post by:
Okay lets see if I can do this with out confusing myself or others. First I will give ALL the details then state my problem and request at the bottom. Tables: tblContacts ID Company LastName FirstName Initial
0
9703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10548
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...
0
10316
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 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...
1
10295
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
10069
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
9125
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...
1
7604
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 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...
0
6842
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();...
3
2970
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.