Open? Refresh? ReQuery? subform

B

Bob Richardson

My form has a combobox and a subform. When I click a value in the combobox
(ClassCodeCombo) I want a different record to appear in the SUBFORM.
Instead, I get the correct record to appear in a brand new form which floats
above the main form (with the old subform still visible). I guess this is
obvious because I said "DoCmd.OpenForm" So my question is, what command do
I want rather than OpenForm?

Here's the VB from my OnCLick Event:

On Error GoTo Err_EventBtn_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "ClassInfo"
stLinkCriteria = "Classes.ClassCode='" & Me!ClassCodeCombo & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_EventBtn_Click:
Exit Sub

Err_EventBtn_Click:
MsgBox Err.Description
Resume Exit_EventBtn_Clic
 
D

David Lloyd

Bob:

One alternative is to use the Link Child Fields and Link Master Fields
properties of the Subform (Data Tab). For the Link Master Fields property
you can use ClassCodeCombo and for the Link Child Fields you can use
[ClassCode].


--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


"Bob Richardson" <bobr at whidbey dot com> wrote in message
My form has a combobox and a subform. When I click a value in the combobox
(ClassCodeCombo) I want a different record to appear in the SUBFORM.
Instead, I get the correct record to appear in a brand new form which floats
above the main form (with the old subform still visible). I guess this is
obvious because I said "DoCmd.OpenForm" So my question is, what command do
I want rather than OpenForm?

Here's the VB from my OnCLick Event:

On Error GoTo Err_EventBtn_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "ClassInfo"
stLinkCriteria = "Classes.ClassCode='" & Me!ClassCodeCombo & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_EventBtn_Click:
Exit Sub

Err_EventBtn_Click:
MsgBox Err.Description
Resume Exit_EventBtn_Clic
 
B

Bob Richardson

Thanks. It worked when I used [EvCode];[ClassCode] for the child, and
EvCode;ClassCodeCombo for the master.

Where can a read about the syntax for these properties? Like, why the child
fields have {} around them, and the master fields don't?
 

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