Use Pop-Up to find record on tab control

G

Gina Whipp

All,

I have searched, played with the code and still have no solution so I am
hoping someone has an answer. (Yep, I searched the newsgroups and still no
joy!) Here's my problem/issue.

I have a pop-up that opens from a form that has several tab pages. What I
want to happen is I open the main form, select a Client from the list box.
I then go to the Hardware Installed tab and select a machine. At that point
I double-click on the machine and opens a pop-up to show me all the
contracts that that particular machine has has. I now ant to double-click
within the pop-up and have it go the tab Hardware Contracts and display that
contract. (And just to make things more interesting, if I select another
contract I want the Hardware Contracts to switch to that contract.)

I have successfully done this before but never with a tab control involved
and for that reason the lines I would normally use are not working. Below
is some of what I have tried...

Forms![frmContracts]![sfrHardwareContracts].SetFocus

***I guess you can't change LinkFields on the fly***
'Forms![frmContracts]![sfrHardwareContracts].LinkChildFields =
Me![txtHardwareContractsID]
'Forms![frmContracts]![sfrHardwareContracts].LinkMasterFields =
Me![txtHardwareContractsID]
Forms![frmContracts]![sfrHardwareContracts].Filter =
Me![txtHardwareContractsID]

'Forms![frmContracts]![sfrHardwareContracts].Form![txtHardwareContractsID].SetFocus
'Forms![frmContracts]![sfrHardwareContracts].Form![txtHardwareContractsID]
= Me![txtHardwareContractsID]

***This doesn't work because I can't seem to switch the focus to the
subform though it does go to the tab page***
'DoCmd.FindRecord FindThis, , True, acSearchAll, True
'Forms![frmContracts]![sfrHardwareContracts].Form![txtHardwareContractsID].Requery


Any and all ideas would be appreciated!!!!

BIG Thanks!
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
 
G

Gina Whipp

You I love it when a plan comes together! I got it...

I simply started AGAIN and ended up with...

Forms![frmContracts]![sfrHardwareContracts].SetFocus

With Forms![frmContracts]![sfrHardwareContracts].Form
.RecordsetClone.FindFirst "hcHardwareContractsID = " &
Me!txtHardwareContractsID

If .RecordsetClone.NoMatch Then
MsgBox "Record not found!"
Else
.Bookmark = .RecordsetClone.Bookmark
End If
End With

Thanks anyway!
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
 
D

Douglas J. Steele

Glad to see that you found a solution to your problem.

The reason why your attempt to change the Link Fields didn't work is because
the LinkChildFields and LinkMasterFields properties are supposed to contain
the name(s) of the fields being linked, not simply their values.

In other words, you probably needed something like:

Forms![frmContracts]![sfrHardwareContracts].LinkChildFields =
"txtHardwareContractsID"
Forms![frmContracts]![sfrHardwareContracts].LinkMasterFields =
"txtHardwareContractsID"
 
G

Gina Whipp

Oddly enough when I tried that scenario it still prompted me for the values.
Now, I f I tied that in I got to the record but it didn't give me the
seamless I wanted. I thought one couldn't change LinkFields without
'closing/reopening' the form? Is that rue or did I misread?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
Douglas J. Steele said:
Glad to see that you found a solution to your problem.

The reason why your attempt to change the Link Fields didn't work is
because the LinkChildFields and LinkMasterFields properties are supposed
to contain the name(s) of the fields being linked, not simply their
values.

In other words, you probably needed something like:

Forms![frmContracts]![sfrHardwareContracts].LinkChildFields =
"txtHardwareContractsID"
Forms![frmContracts]![sfrHardwareContracts].LinkMasterFields =
"txtHardwareContractsID"


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Gina Whipp said:
All,

I have searched, played with the code and still have no solution so I am
hoping someone has an answer. (Yep, I searched the newsgroups and still
no joy!) Here's my problem/issue.

I have a pop-up that opens from a form that has several tab pages. What
I want to happen is I open the main form, select a Client from the list
box. I then go to the Hardware Installed tab and select a machine. At
that point I double-click on the machine and opens a pop-up to show me
all the contracts that that particular machine has has. I now ant to
double-click within the pop-up and have it go the tab Hardware Contracts
and display that contract. (And just to make things more interesting, if
I select another contract I want the Hardware Contracts to switch to that
contract.)

I have successfully done this before but never with a tab control
involved and for that reason the lines I would normally use are not
working. Below is some of what I have tried...

Forms![frmContracts]![sfrHardwareContracts].SetFocus

***I guess you can't change LinkFields on the fly***
'Forms![frmContracts]![sfrHardwareContracts].LinkChildFields =
Me![txtHardwareContractsID]
'Forms![frmContracts]![sfrHardwareContracts].LinkMasterFields =
Me![txtHardwareContractsID]
Forms![frmContracts]![sfrHardwareContracts].Filter =
Me![txtHardwareContractsID]


'Forms![frmContracts]![sfrHardwareContracts].Form![txtHardwareContractsID].SetFocus

'Forms![frmContracts]![sfrHardwareContracts].Form![txtHardwareContractsID]
= Me![txtHardwareContractsID]

***This doesn't work because I can't seem to switch the focus to the
subform though it does go to the tab page***
'DoCmd.FindRecord FindThis, , True, acSearchAll, True

'Forms![frmContracts]![sfrHardwareContracts].Form![txtHardwareContractsID].Requery


Any and all ideas would be appreciated!!!!

BIG Thanks!
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II
 
D

Douglas J. Steele

I know it's definitely possible to create a form/subform situation where the
fields are left blank and then assign them values in code. I haven't tested,
though, whether it's possible to change the values when they're already
linked. You might have to do a requery, but that should be it.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Gina Whipp said:
Oddly enough when I tried that scenario it still prompted me for the
values. Now, I f I tied that in I got to the record but it didn't give me
the seamless I wanted. I thought one couldn't change LinkFields without
'closing/reopening' the form? Is that rue or did I misread?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
Douglas J. Steele said:
Glad to see that you found a solution to your problem.

The reason why your attempt to change the Link Fields didn't work is
because the LinkChildFields and LinkMasterFields properties are supposed
to contain the name(s) of the fields being linked, not simply their
values.

In other words, you probably needed something like:

Forms![frmContracts]![sfrHardwareContracts].LinkChildFields =
"txtHardwareContractsID"
Forms![frmContracts]![sfrHardwareContracts].LinkMasterFields =
"txtHardwareContractsID"
 
G

Gina Whipp

My fields are not blank, so perhaps the requery would have worked. I'll
have to give that try once I finish making my other changes. (Of course on
a sample, hate to mess up what I finially got to work.) Thanks for the
info!

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
Douglas J. Steele said:
I know it's definitely possible to create a form/subform situation where
the fields are left blank and then assign them values in code. I haven't
tested, though, whether it's possible to change the values when they're
already linked. You might have to do a requery, but that should be it.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Gina Whipp said:
Oddly enough when I tried that scenario it still prompted me for the
values. Now, I f I tied that in I got to the record but it didn't give me
the seamless I wanted. I thought one couldn't change LinkFields without
'closing/reopening' the form? Is that rue or did I misread?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II
Douglas J. Steele said:
Glad to see that you found a solution to your problem.

The reason why your attempt to change the Link Fields didn't work is
because the LinkChildFields and LinkMasterFields properties are supposed
to contain the name(s) of the fields being linked, not simply their
values.

In other words, you probably needed something like:

Forms![frmContracts]![sfrHardwareContracts].LinkChildFields =
"txtHardwareContractsID"
Forms![frmContracts]![sfrHardwareContracts].LinkMasterFields =
"txtHardwareContractsID"
 

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