473,748 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open form to specific record as double-clicked on separate form

WyvsEyeView
46 New Member
Okay, now I need to open a form (frmTopics) and select the same record that has been double-clicked on in a separate form (frmTopicsFound ). Here are the details:

frmTopicsFound contains datasheet subform sfrmTopicsFound . sfrmTopicsFound is populated from a query that returns a list of topics based on a keyword search. I want users to be able to double-click a row in sfrmTopicsFound and have frmTopics open to that same record. frmTopics may or may not not be open already.

So basically, I need some code on the OnDlbClick event for sfrmTopicsFound .nbrTopID that will:

1. Open frmTopics if it's not already open
2. Display the record from tblTopics where tblTopics.topID = Forms!sfrmTopic sFound!nbrTopID

I'm sure this has been done so if anyone could point me to some sample code, maybe I can take it from there. Thanks!
Sep 2 '08 #1
19 7808
NeoPa
32,571 Recognized Expert Moderator MVP
Basically, in the Double-click event procedure you would call the open of the form but with a WhereCondition set to a string which identifies the record selected.
Expand|Select|Wrap|Line Numbers
  1. "[TopID]=" & Me.nbrTopID
Does that give you enough?
Sep 2 '08 #2
NeoPa
32,571 Recognized Expert Moderator MVP
By the way, I used Me.nbrTopID rather than Forms!sfrmTopic sFound!nbrTopID as, presumably, the code runs within the same form as the control is contained in.
Sep 2 '08 #3
WyvsEyeView
46 New Member
When I double click the field, I am getting a parameter box, where I have to manually enter the topic ID that I double-clicked on in sfrmTopicsFound . So apparently the value in sfrmTopicsFound .nbrTopID is not being read into the parameter. After I manually enter the topic ID, the correct topic appears in frmTopics. Here is my line of code:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "frmTopics", , , "nbrTopID=" & Me.nbrTopID
Something similar happened in another situation and the problem turned out to be the relationship between forms and subforms. Could I possibly need to change

Expand|Select|Wrap|Line Numbers
  1. Me.nbrTopID
to syntax as if I were on the main form referring to the subform or something along those lines?

BTW, nbrTopID is an autogenerated number field.
Sep 2 '08 #4
WyvsEyeView
46 New Member
Or could it have anything to do with the fact that my subform is a datasheet and not a single form with only one record displayed at a time?
Sep 2 '08 #5
NeoPa
32,571 Recognized Expert Moderator MVP
Is the code in the module of the main form or the subform?
Sep 3 '08 #6
WyvsEyeView
46 New Member
The code is in the subform because that is where the double-clicked field is.
Sep 3 '08 #7
NeoPa
32,571 Recognized Expert Moderator MVP
Please try the following code before your DoCmd.OpenForm line and post what you see :
Expand|Select|Wrap|Line Numbers
  1. Call MsgBox("nbrTopID=" & Me.nbrTopID)
BTW I was expecting the code SHOULD be in the subform, but people do funny things sometimes ;)
Sep 3 '08 #8
WyvsEyeView
46 New Member
I got a message box saying "nbrTopID = 7" which happens to be the id number of the first record returned by the particular keyword search I used in this instance.

And I am very likely to be one of those people doing funny things! :)
Sep 4 '08 #9
NeoPa
32,571 Recognized Expert Moderator MVP
I think we need to look at the underlying query then.

Let's first try opening the form without any WhereCondition and see what results you see.
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "frmTopics"
Sep 4 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

6
44109
by: Hari Om | last post by:
Here are the details of my error log files: I execute the command and get following message at console: ---------------------------------------------------------------------- ../sqlldr scott/tiger@common control=/full_path/test.ctl log=/full_path/adhoc/test.log SQL*Loader: Release 9.2.0.1.0 - Production on Tue Sep 2 10:49:27 2003 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
1
16922
by: Bernard Drolet | last post by:
Hi, I have a recursive table "Objectnew" with the columns "objectref" (primary key), objectname, objectid, and parentobjectid Recursive Relation: objectid ----< Parentobjectid I have the following cursor that extracts information about all objects with a specific name below a starting point DECLARE CURSOR findChildren( starting Objectnew.objectref%TYPE,
46
6022
by: Steve | last post by:
Access97 Database The database is split into a frontend and backend and not connected to any other database. The database has an unbound report with 15 subreports. Some of the subreports include Excel charts in unbound object frames. When I add 3 additional subreports, I get the error message that Access can't open any more databases. Can anyone suggest what may be causing the error message. Thanks!
9
1977
by: ferbar | last post by:
Hi all, I'm trying to read from the txt file 'ip.packets.2.txt' using the read function. It seems everything ok, but I get a -1 when executing >>bytesr = read(fdo1, bufread, 2); The 'open' function returns the file dsc 3. So this seems ok.. Any idea what might be wrong?
3
3036
by: Thief_ | last post by:
I need to use an existing IE window which already has a specific url and re-use that window for a new URL. Example: One open IE window has the following in its Address Bar: http://www.vbcity.com/forums/search.asp?mode=doit The window title is:
0
953
by: Kevin | last post by:
I have a workflow application that uses email notifications which include a link for the user to visit a specific approval web page. For example ApprovalPage.aspx?ID=25 I want to replace the web application with a windows application. How would I open a windows application from an email and navigate to a specific record? Thanks for your help!
0
1313
by: Wayne | last post by:
The following problem started on my PC about a week ago and I can't link it to any specific change. I'm using Access XP. If I have any database open and try to open any other database by double clicking its file in Explorer, it takes about 5 seconds to open. Previously the second database would open almost instantaneously, as one would expect on a reasonably fast machine. However if I have any database open and then open a second...
0
1961
by: Wayne | last post by:
Original Post: The following problem started on my PC about a week ago and I can't link it to any specific change. I'm using Access XP. If I have any database open and try to open any other database by double clicking its file in Explorer, it takes about 5 seconds to open. Previously the second database would open almost instantaneously, as one would expect on a reasonably fast machine.
3
3847
by: Cagey | last post by:
What I'm trying for: If this selection or if click on selection (highlighted line choice/ which ever selection change) w/in query's combo dropdown list box (on Switchboard), then Open in Datasheet View, the specific underlying record's Row... showing all columns Or selected columns. For a specific row's record ONLY, Or for all Xs (same type), or for the whole data sheet (all records... includes all types then), but focus still opens...
0
1677
by: howkoss | last post by:
Hi, I've been very frustrated for 2 days trying to make this work. I started with a built-in template "Projects" that came with Access 2007. On the "Employee List" I can click on any cell and bring up the Employee Detail" corresponding to that particular cell. That works fine. I want to be able to open "Employee Detail" when I click on a cell in "Project Detail". I got to the point that "Employee Detail" opens but only to the frst record. PLEASE...
0
9541
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
9370
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
9321
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
8242
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
6796
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
6074
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
4602
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...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
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 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.