A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

open form/subform at specific record



 
 
Thread Tools Display Modes
  #1  
Old February 11th, 2010, 06:24 PM posted to microsoft.public.access.gettingstarted
John
external usenet poster
 
Posts: 2,649
Default open form/subform at specific record

I have a form (repair status) the has the same field (work order #) as
another form which is actually a subform(work order detail) to a main form
(Customer data). What I want to do is double click on the field (work order
#) and have it open the form (customer data)/(work order detail) at that
specific record.

I selected On Dbl Click to run a macro that opens the form where both field
match. That works but it pulls the customer data form and the work order
detail but it goes to the first work order detail associated to that customer
not the specific on i clicked on. Any idea what i'm doing wrong.

This is the condition i'm using in the macro.

[Work Order Number]=[Forms]![Frm Work Order Status]![Qry Open Work
Orders].[Form]![Work Order Number]
  #2  
Old February 11th, 2010, 09:16 PM posted to microsoft.public.access.gettingstarted
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default open form/subform at specific record

Instead of condition try adding the following actions --
GoToControl --- [Work Order Number]
FindRecord ---- [Forms]![Frm Work Order Status]![Qry Open Work
Orders].[Form]![Work Order Number]

--
Build a little, test a little.


"john" wrote:

I have a form (repair status) the has the same field (work order #) as
another form which is actually a subform(work order detail) to a main form
(Customer data). What I want to do is double click on the field (work order
#) and have it open the form (customer data)/(work order detail) at that
specific record.

I selected On Dbl Click to run a macro that opens the form where both field
match. That works but it pulls the customer data form and the work order
detail but it goes to the first work order detail associated to that customer
not the specific on i clicked on. Any idea what i'm doing wrong.

This is the condition i'm using in the macro.

[Work Order Number]=[Forms]![Frm Work Order Status]![Qry Open Work
Orders].[Form]![Work Order Number]

  #3  
Old February 11th, 2010, 09:38 PM posted to microsoft.public.access.gettingstarted
John
external usenet poster
 
Posts: 2,649
Default open form/subform at specific record

I tried this but the field i'm looking to match and open to is in the
subform. When I try this i get an error stating there is no field call Work
Order Number.

"KARL DEWEY" wrote:

Instead of condition try adding the following actions --
GoToControl --- [Work Order Number]
FindRecord ---- [Forms]![Frm Work Order Status]![Qry Open Work
Orders].[Form]![Work Order Number]

--
Build a little, test a little.


"john" wrote:

I have a form (repair status) the has the same field (work order #) as
another form which is actually a subform(work order detail) to a main form
(Customer data). What I want to do is double click on the field (work order
#) and have it open the form (customer data)/(work order detail) at that
specific record.

I selected On Dbl Click to run a macro that opens the form where both field
match. That works but it pulls the customer data form and the work order
detail but it goes to the first work order detail associated to that customer
not the specific on i clicked on. Any idea what i'm doing wrong.

This is the condition i'm using in the macro.

[Work Order Number]=[Forms]![Frm Work Order Status]![Qry Open Work
Orders].[Form]![Work Order Number]

  #4  
Old February 12th, 2010, 12:33 AM posted to microsoft.public.access.gettingstarted
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default open form/subform at specific record

Try telling it to go to subform the same way you reference the subform --
[Forms]![Frm Work Order Status]![Qry Open Work Orders].[Form]![Work Order
Number]

--
Build a little, test a little.


"john" wrote:

I tried this but the field i'm looking to match and open to is in the
subform. When I try this i get an error stating there is no field call Work
Order Number.

"KARL DEWEY" wrote:

Instead of condition try adding the following actions --
GoToControl --- [Work Order Number]
FindRecord ---- [Forms]![Frm Work Order Status]![Qry Open Work
Orders].[Form]![Work Order Number]

--
Build a little, test a little.


"john" wrote:

I have a form (repair status) the has the same field (work order #) as
another form which is actually a subform(work order detail) to a main form
(Customer data). What I want to do is double click on the field (work order
#) and have it open the form (customer data)/(work order detail) at that
specific record.

I selected On Dbl Click to run a macro that opens the form where both field
match. That works but it pulls the customer data form and the work order
detail but it goes to the first work order detail associated to that customer
not the specific on i clicked on. Any idea what i'm doing wrong.

This is the condition i'm using in the macro.

[Work Order Number]=[Forms]![Frm Work Order Status]![Qry Open Work
Orders].[Form]![Work Order Number]

  #5  
Old February 12th, 2010, 06:08 PM posted to microsoft.public.access.gettingstarted
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default open form/subform at specific record

I can't say how, or if, this could be done in a macro, but the following is
adapted from some code of my own which does a similar thing. You'd enter the
code as the DblClick event procedure of the control in your repair status
form:

Dim rst As Object
Dim frm As Form
Dim fsub As Form
Dim lngWorkOrderNumber As Long
Dim lngCustomerID As Long

lngWorkOrderNumber = Me.[Work Order Number]
lngCustomerID = Me.[CustomerID]

' open form at current work order's customer
DoCmd.OpenForm "Customer Data", _
WhereCondition:="[CustomerID] = " & lngCustomerID

Set frm = Forms("Customer Data")
Set fsub = frm.Controls("Work Order Detail").Form
Set rst = fsub.Recordset.Clone

' move to current work order in subform
With rst
.findFirst "[Work Order Number] = " & lngWorkOrderNumber
If Not .NoMatch Then
fsub.Bookmark = .Bookmark
End If
End With

I've had to make a few assumptions:

1. That the recordset underlying the form in whose module the code is
running includes a field CustomerID of number data type, i.e. it’s a foreign
key in the orders table which references the primary key of the customer data
table.

2. The primary key of the customer data table is also a number data type and
called CustomerID.

3. That the subform control on the customer data form, i.e. the control
which houses the subform, is named Work Order Detail.

4. That the Work Order Number field is a number data type.

If the code is in the module of a subform in the orders form, and the
CustomerID field is in the recordset of its parent form you'd need to amend
the code so it gets the value from the parent form like so:

lngCustomerID = Me.Parent.[CustomerID]

Ken Sheridan
Stafford, England

john wrote:
I have a form (repair status) the has the same field (work order #) as
another form which is actually a subform(work order detail) to a main form
(Customer data). What I want to do is double click on the field (work order
#) and have it open the form (customer data)/(work order detail) at that
specific record.

I selected On Dbl Click to run a macro that opens the form where both field
match. That works but it pulls the customer data form and the work order
detail but it goes to the first work order detail associated to that customer
not the specific on i clicked on. Any idea what i'm doing wrong.

This is the condition i'm using in the macro.

[Work Order Number]=[Forms]![Frm Work Order Status]![Qry Open Work
Orders].[Form]![Work Order Number]


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...arted/201002/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.