473,832 Members | 2,138 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 2972
"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
MsgBox "Cannot locate contact no: " & strOpenArgs, _
vbExclamation, _
"Record location error"
End If

End With

End If

Exit Sub

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

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?...
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...
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...
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.
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.
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 = '"...
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:...
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...
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
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...
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...
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...
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.