Open a subform with a combox

G

Guest

I want to open a from but the field the is being used is a subform with the
main. How can I tell it to look in the subform for this field and open it.
This is what I usually use with a combox.

Main form Name: RequestUpdate
Sub Form Name: RMAUpdateFm
Field Name: RcdID

Private Sub CmdOpenResponseFm_Click()
On Error GoTo Err_CmdOpenResponseFm_Click

Dim stDocNameOpenRMARequest As String
Dim stLinkCriteria As String

stDocNameOpenRMARequest = "RequestUpdate"

stLinkCriteria = ""

stLinkCriteria = "[RcdID]=" & "" & Me![CboRMANub] & ""
DoCmd.OpenForm stDocNameOpenRMARequest, , , stLinkCriteria

Exit_CmdOpenResponseFm_Click:
Exit Sub

Err_CmdOpenResponseFm_Click:
MsgBox Err.Description
Resume Exit_CmdOpenResponseFm_Click

End Sub

Can anyone help!!!
 
C

Carl Rapson

If you mean that cboRMANub is on the subform RMAUpdateFm, then you should be
able to use

stLinkCriteria = "[RcdID]=" & "" & Me.RMAUpdateFm.Form.CboRMANub & ""

Carl Rapson
 
G

Guest

Actually, RcdID is a field on the RMAUpdateFm. CboRMANub is the name of the
Combo Box that is a list of all the RcdID. So you select the correct RcdID
from the combo box and you push a button to open the corrisponding
information in the RequestUdate form. But within that RequestUpdate form is
the RMAUpdateFM where the actual field RcdID is linked to.

So my guess is this will need to be changed?

stLinkCriteria = "[RcdID]=" & "" & Me.RMAUpdateFm.Form.CboRMANub & ""

Carl Rapson said:
If you mean that cboRMANub is on the subform RMAUpdateFm, then you should be
able to use

stLinkCriteria = "[RcdID]=" & "" & Me.RMAUpdateFm.Form.CboRMANub & ""

Carl Rapson

Kat said:
I want to open a from but the field the is being used is a subform with the
main. How can I tell it to look in the subform for this field and open
it.
This is what I usually use with a combox.

Main form Name: RequestUpdate
Sub Form Name: RMAUpdateFm
Field Name: RcdID

Private Sub CmdOpenResponseFm_Click()
On Error GoTo Err_CmdOpenResponseFm_Click

Dim stDocNameOpenRMARequest As String
Dim stLinkCriteria As String

stDocNameOpenRMARequest = "RequestUpdate"

stLinkCriteria = ""

stLinkCriteria = "[RcdID]=" & "" & Me![CboRMANub] & ""
DoCmd.OpenForm stDocNameOpenRMARequest, , , stLinkCriteria

Exit_CmdOpenResponseFm_Click:
Exit Sub

Err_CmdOpenResponseFm_Click:
MsgBox Err.Description
Resume Exit_CmdOpenResponseFm_Click

End Sub

Can anyone help!!!
 
C

Carl Rapson

I'm a little confused. You have a main form RequestUpdate that contains a
subform, RMSUpdateFm. Within that subform is a combo box, cboRMANub, that is
bound to the field RcdID. When the user makes a selection in the combo box,
you want to have that record displayed in the main form. Is this correct?

If it is, I'd suggest that you rethink your design. What is the link field
between the main form and the subform? Should you really be changing the
record that displays in the main form based on a selection in the subform?
Why is the combo box on the subform instead of on the main form? If all you
want to do is allow the user to select a value for RcdID and then display
the corresponding record on the main form, you should just put an unbound
combo box on the main form and populate it with the RdcID values. If the
subform is linked to the main form via RcdID, then the subform will
automatically display the correct records when the main form does.

Carl Rapson

Kat said:
Actually, RcdID is a field on the RMAUpdateFm. CboRMANub is the name of
the
Combo Box that is a list of all the RcdID. So you select the correct
RcdID
from the combo box and you push a button to open the corrisponding
information in the RequestUdate form. But within that RequestUpdate form
is
the RMAUpdateFM where the actual field RcdID is linked to.

So my guess is this will need to be changed?

stLinkCriteria = "[RcdID]=" & "" & Me.RMAUpdateFm.Form.CboRMANub & ""

Carl Rapson said:
If you mean that cboRMANub is on the subform RMAUpdateFm, then you should
be
able to use

stLinkCriteria = "[RcdID]=" & "" & Me.RMAUpdateFm.Form.CboRMANub & ""

Carl Rapson

Kat said:
I want to open a from but the field the is being used is a subform with
the
main. How can I tell it to look in the subform for this field and open
it.
This is what I usually use with a combox.

Main form Name: RequestUpdate
Sub Form Name: RMAUpdateFm
Field Name: RcdID

Private Sub CmdOpenResponseFm_Click()
On Error GoTo Err_CmdOpenResponseFm_Click

Dim stDocNameOpenRMARequest As String
Dim stLinkCriteria As String

stDocNameOpenRMARequest = "RequestUpdate"

stLinkCriteria = ""

stLinkCriteria = "[RcdID]=" & "" & Me![CboRMANub] & ""
DoCmd.OpenForm stDocNameOpenRMARequest, , , stLinkCriteria

Exit_CmdOpenResponseFm_Click:
Exit Sub

Err_CmdOpenResponseFm_Click:
MsgBox Err.Description
Resume Exit_CmdOpenResponseFm_Click

End Sub

Can anyone help!!!
 

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

Similar Threads


Top