How do i jump to a specific record on another Page?

D

Douglas

I have a form which has a Tab control with 2 pages on it.
On Page 1 I have a sub-form with selected data taken from the Page 2
Then when the user clicks a record on the subform on Page 1 , it opens
up page 2 and jumps to the correct record.

My scenario is like this
(you need a courier font to display it)

-----------------
|Customer|Invoices|
| |________|___________________
| |
| Cust No. ____________ |
| Cust Name | Inv. No.s | |
| |------------| |
| Cust Addr | xxxx | |
| etc etc | xxxx | |
| xxxxxxxxx | xxxx | |
| xxxxxxxxx | xxxx | |
| xxxxxxxxx ------------ |
| xxxxxxxxx |
-------------------------------------

Page 1 contains customer details and Page 2 contains the customer
Invoice details. One Customer -> Many Invoices with Cust No as the
Key.
The subform (continous forms) on Page 1 (Customer) contains only
Invoice numbers which
when clicked , i want to jump to Page 2 (Invoices) and locate and
display the invoice details.

Can anyone tell me the Click Event code i need to jump to a specific
record when an invoice number is clicked on the subform.

I use:

Forms![Customer].TabCtl.Value = 1

to jump to the Invoices Page but what code can i use to locate the
record.

i tried

DoCmd.GoToRecord acDataForm, "Invoices", acGoTo, 2

just as a test to jump to record 2 but it errors with

Run-time erorr '2489'
The object 'Invoices' isn't open.

even though the form is open at the time the line of code is executed.


Id really appreciate any help here

TIA

Doug
 
M

Marshall Barton

Douglas said:
I have a form which has a Tab control with 2 pages on it.
On Page 1 I have a sub-form with selected data taken from the Page 2
Then when the user clicks a record on the subform on Page 1 , it opens
up page 2 and jumps to the correct record.

My scenario is like this
(you need a courier font to display it)

-----------------
|Customer|Invoices|
| |________|___________________
| |
| Cust No. ____________ |
| Cust Name | Inv. No.s | |
| |------------| |
| Cust Addr | xxxx | |
| etc etc | xxxx | |
| xxxxxxxxx | xxxx | |
| xxxxxxxxx | xxxx | |
| xxxxxxxxx ------------ |
| xxxxxxxxx |
-------------------------------------

Page 1 contains customer details and Page 2 contains the customer
Invoice details. One Customer -> Many Invoices with Cust No as the
Key.
The subform (continous forms) on Page 1 (Customer) contains only
Invoice numbers which
when clicked , i want to jump to Page 2 (Invoices) and locate and
display the invoice details.

Can anyone tell me the Click Event code i need to jump to a specific
record when an invoice number is clicked on the subform.

I use:

Forms![Customer].TabCtl.Value = 1

to jump to the Invoices Page but what code can i use to locate the
record.

i tried

DoCmd.GoToRecord acDataForm, "Invoices", acGoTo, 2

just as a test to jump to record 2 but it errors with

Run-time erorr '2489'
The object 'Invoices' isn't open.

even though the form is open at the time the line of code is executed.

Actually, the SUBform is not open, only open main forms are
members of the Forms collection.

Synching the the invoice details subform to the selected
invoice number on page 1 would be automatic if you set the
details subform control's Link Master/Child properties. I
believe all you have to do is set the Link Child property to
the invoicenumber field and the Link Master property to
invnumsubform.Form.invoicenumber
(using you own control names of course).

I suggest that you not jump to the invoice details subform
whenever someone clicks on an invoice number. Doing that
will prevent using the invoice numbers subform to add a new
number or to correct a mistake in an existing number. Maybe
you have another mechanism for those operations, but you
might want to think about using a separate button to show
the invoice details (don't forget that the tab control's
second tab will serve as that button).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top