open same record but new form

B

Brandie

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
S

Sprinks

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks
 
B

Brandie

This what I have. I tried what you said but it changed back to this. I
saved it twice and it still changes back to what I had before: [BAA/RFP/RFI
Number]=[Forms]![frmInfoEval]![BAA/RFP/RFI Number] And
[Subject]=[Forms]![frmInfoEval]![Subject] And [Candidate
Technology]=[Forms]![frmInfoEval]![Candidate Technology]

Sprinks said:
Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

Brandie said:
The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
B

Brandie

I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

Sprinks said:
Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

Brandie said:
The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
S

Sprinks

Brandie,

The right hand side of the stLinkCriteria assignment statement must evaluate
to a string, so enclose all literals in quotes, and contatenate them with the
& operator:

The right hand side should be:

"[BAA/RFP/RFI Number]= " & [Forms]![frmInfoEval]![BAA/RFP/RFI Number] & _
" And [Subject]= " & [Forms]![frmInfoEval]![Subject] & _
" And [Candidate Technology]=" & [Forms]![frmInfoEval]![Candidate Technology]

You can substitute Me! for [Forms]![frmInfoEval]! if you like, assuming it
is the current form.

Hope that helps.
Sprinks
Brandie said:
This what I have. I tried what you said but it changed back to this. I
saved it twice and it still changes back to what I had before: [BAA/RFP/RFI
Number]=[Forms]![frmInfoEval]![BAA/RFP/RFI Number] And
[Subject]=[Forms]![frmInfoEval]![Subject] And [Candidate
Technology]=[Forms]![frmInfoEval]![Candidate Technology]

Sprinks said:
Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

Brandie said:
The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
B

Brandie

This still doesn't work please read the second reply i posted, I thnk it has
something to do with the subform.

Sprinks said:
Brandie,

The right hand side of the stLinkCriteria assignment statement must evaluate
to a string, so enclose all literals in quotes, and contatenate them with the
& operator:

The right hand side should be:

"[BAA/RFP/RFI Number]= " & [Forms]![frmInfoEval]![BAA/RFP/RFI Number] & _
" And [Subject]= " & [Forms]![frmInfoEval]![Subject] & _
" And [Candidate Technology]=" & [Forms]![frmInfoEval]![Candidate Technology]

You can substitute Me! for [Forms]![frmInfoEval]! if you like, assuming it
is the current form.

Hope that helps.
Sprinks
Brandie said:
This what I have. I tried what you said but it changed back to this. I
saved it twice and it still changes back to what I had before: [BAA/RFP/RFI
Number]=[Forms]![frmInfoEval]![BAA/RFP/RFI Number] And
[Subject]=[Forms]![frmInfoEval]![Subject] And [Candidate
Technology]=[Forms]![frmInfoEval]![Candidate Technology]

Sprinks said:
Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
B

Brandie

Ok...I figured it out but I'm getting an error that says "type mismatch." On
the first form the fields are combo boxes that look up from another table.
Brandie,

The right hand side of the stLinkCriteria assignment statement must evaluate
to a string, so enclose all literals in quotes, and contatenate them with the
& operator:

The right hand side should be:

"[BAA/RFP/RFI Number]= " & [Forms]![frmInfoEval]![BAA/RFP/RFI Number] & _
" And [Subject]= " & [Forms]![frmInfoEval]![Subject] & _
" And [Candidate Technology]=" & [Forms]![frmInfoEval]![Candidate Technology]

You can substitute Me! for [Forms]![frmInfoEval]! if you like, assuming it
is the current form.

Hope that helps.
Sprinks
Brandie said:
This what I have. I tried what you said but it changed back to this. I
saved it twice and it still changes back to what I had before: [BAA/RFP/RFI
Number]=[Forms]![frmInfoEval]![BAA/RFP/RFI Number] And
[Subject]=[Forms]![frmInfoEval]![Subject] And [Candidate
Technology]=[Forms]![frmInfoEval]![Candidate Technology]

Sprinks said:
Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
S

Sprinks

Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

Brandie said:
I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

Sprinks said:
Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

Brandie said:
The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
S

Sprinks

Hi, Brandie.

See my recent post, which may eliminate the need to use any code at all, but
the Type mismatch error is a mismatch between the passed values. I suspect
the reason is because even though the combo box is displaying text, the Bound
Column of the combo box is a numeric code; so you are trying to equate a
number to a string.

Sprinks

Brandie said:
Ok...I figured it out but I'm getting an error that says "type mismatch." On
the first form the fields are combo boxes that look up from another table.
Brandie,

The right hand side of the stLinkCriteria assignment statement must evaluate
to a string, so enclose all literals in quotes, and contatenate them with the
& operator:

The right hand side should be:

"[BAA/RFP/RFI Number]= " & [Forms]![frmInfoEval]![BAA/RFP/RFI Number] & _
" And [Subject]= " & [Forms]![frmInfoEval]![Subject] & _
" And [Candidate Technology]=" & [Forms]![frmInfoEval]![Candidate Technology]

You can substitute Me! for [Forms]![frmInfoEval]! if you like, assuming it
is the current form.

Hope that helps.
Sprinks
Brandie said:
This what I have. I tried what you said but it changed back to this. I
saved it twice and it still changes back to what I had before: [BAA/RFP/RFI
Number]=[Forms]![frmInfoEval]![BAA/RFP/RFI Number] And
[Subject]=[Forms]![frmInfoEval]![Subject] And [Candidate
Technology]=[Forms]![frmInfoEval]![Candidate Technology]

:

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
B

Brandie

.......The first form has a subform linked by the BAA/RFP/RFI Number. The
second form should be opening the record with the same info in the three
fields that appear on the subform. I almost got the code to work but I keep
getting an error that says "type Mismatch" What now?

Sprinks said:
Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

Brandie said:
I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

Sprinks said:
Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
S

Sprinks

Brandie,

I think the easiest way to implement this, requiring no code, is to place
your second subform as a subform on your first, rather than on the main form.
Link the two on all three fields, and they should always display the related
information.

"Type mismatch" occurs when expressions on opposite sides of an equal sign
are of different types. As I posted, this is probably due to trying to
equate the value of a combo box (which may *display* text, but actually *be*
a number) to an actual text value. Try inserting Msgbox statements or
writing the values to the Immediate Window with Debug.Print, for example:

MsgBox "MyControl = " & Me!MyControl

Hope that helps.
Sprinks

Brandie said:
......The first form has a subform linked by the BAA/RFP/RFI Number. The
second form should be opening the record with the same info in the three
fields that appear on the subform. I almost got the code to work but I keep
getting an error that says "type Mismatch" What now?

Sprinks said:
Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

Brandie said:
I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

:

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
B

Brandie

Misunderstanding.....the main form has one subform with a command button that
opens another form (it isn't a second subform). I think I got it if you can
tell me how to get rid of the type mismatch error, but I'm not sure.

Sprinks said:
Brandie,

I think the easiest way to implement this, requiring no code, is to place
your second subform as a subform on your first, rather than on the main form.
Link the two on all three fields, and they should always display the related
information.

"Type mismatch" occurs when expressions on opposite sides of an equal sign
are of different types. As I posted, this is probably due to trying to
equate the value of a combo box (which may *display* text, but actually *be*
a number) to an actual text value. Try inserting Msgbox statements or
writing the values to the Immediate Window with Debug.Print, for example:

MsgBox "MyControl = " & Me!MyControl

Hope that helps.
Sprinks

Brandie said:
......The first form has a subform linked by the BAA/RFP/RFI Number. The
second form should be opening the record with the same info in the three
fields that appear on the subform. I almost got the code to work but I keep
getting an error that says "type Mismatch" What now?

Sprinks said:
Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

:

I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

:

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
S

Sprinks

Brandie,

OK, got it now.

Please post:

- the name of your subform
- the ControlSource of each of the 3 subform controls you want to use as
matching criteria
- the Bound Column & the RowSource properties of any combo boxes on your
subform
- the field types of each of the corresponding fields in the RecordSource of
the second form
- the location of the command button that opens the second form. Is it on
the main form or the subform?

Sprinks
Brandie said:
Misunderstanding.....the main form has one subform with a command button that
opens another form (it isn't a second subform). I think I got it if you can
tell me how to get rid of the type mismatch error, but I'm not sure.

Sprinks said:
Brandie,

I think the easiest way to implement this, requiring no code, is to place
your second subform as a subform on your first, rather than on the main form.
Link the two on all three fields, and they should always display the related
information.

"Type mismatch" occurs when expressions on opposite sides of an equal sign
are of different types. As I posted, this is probably due to trying to
equate the value of a combo box (which may *display* text, but actually *be*
a number) to an actual text value. Try inserting Msgbox statements or
writing the values to the Immediate Window with Debug.Print, for example:

MsgBox "MyControl = " & Me!MyControl

Hope that helps.
Sprinks

Brandie said:
......The first form has a subform linked by the BAA/RFP/RFI Number. The
second form should be opening the record with the same info in the three
fields that appear on the subform. I almost got the code to work but I keep
getting an error that says "type Mismatch" What now?

:

Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

:

I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

:

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
B

Brandie

- the name of subform: frmStanEvalQry
- the ControlSource of each of the 3 subform controls you want to use as
matching criteria: BAA/RFP/RFI Number,Subject,Candidate Technology
- the Bound Column & the RowSource properties of any combo boxes on your
subform: Bound Column: Subject ID
Row Source: SELECT tblSubject.[Subject ID],
tblSubject.[Subject] FROM tblsubject;
Bound Column: Technology ID
Row Source: SELECT tblTechnologies.[Technology ID],
tblTechnologies.[Technology Name] FROM tblTechnologies;
- the field types of each of the corresponding fields in the RecordSource of
the second form: They are combo boxes as well, but I think i need them to
be text boxes?
- the location of the command button that opens the second form. Is it on
the main form or the subform? Subform


Sprinks said:
Brandie,

OK, got it now.

Please post:

- the name of your subform
- the ControlSource of each of the 3 subform controls you want to use as
matching criteria
- the Bound Column & the RowSource properties of any combo boxes on your
subform
- the field types of each of the corresponding fields in the RecordSource of
the second form
- the location of the command button that opens the second form. Is it on
the main form or the subform?

Sprinks
Brandie said:
Misunderstanding.....the main form has one subform with a command button that
opens another form (it isn't a second subform). I think I got it if you can
tell me how to get rid of the type mismatch error, but I'm not sure.

Sprinks said:
Brandie,

I think the easiest way to implement this, requiring no code, is to place
your second subform as a subform on your first, rather than on the main form.
Link the two on all three fields, and they should always display the related
information.

"Type mismatch" occurs when expressions on opposite sides of an equal sign
are of different types. As I posted, this is probably due to trying to
equate the value of a combo box (which may *display* text, but actually *be*
a number) to an actual text value. Try inserting Msgbox statements or
writing the values to the Immediate Window with Debug.Print, for example:

MsgBox "MyControl = " & Me!MyControl

Hope that helps.
Sprinks

:

......The first form has a subform linked by the BAA/RFP/RFI Number. The
second form should be opening the record with the same info in the three
fields that appear on the subform. I almost got the code to work but I keep
getting an error that says "type Mismatch" What now?

:

Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

:

I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

:

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
B

Brandie

Wait a sec.....Row source for Subject Combo box is "tblSUbject" not "SELECT
tblSubject.[Subject ID], tblSubject.[Subject] FROM tblSubject;"

Sprinks said:
Brandie,

OK, got it now.

Please post:

- the name of your subform
- the ControlSource of each of the 3 subform controls you want to use as
matching criteria
- the Bound Column & the RowSource properties of any combo boxes on your
subform
- the field types of each of the corresponding fields in the RecordSource of
the second form
- the location of the command button that opens the second form. Is it on
the main form or the subform?

Sprinks
Brandie said:
Misunderstanding.....the main form has one subform with a command button that
opens another form (it isn't a second subform). I think I got it if you can
tell me how to get rid of the type mismatch error, but I'm not sure.

Sprinks said:
Brandie,

I think the easiest way to implement this, requiring no code, is to place
your second subform as a subform on your first, rather than on the main form.
Link the two on all three fields, and they should always display the related
information.

"Type mismatch" occurs when expressions on opposite sides of an equal sign
are of different types. As I posted, this is probably due to trying to
equate the value of a combo box (which may *display* text, but actually *be*
a number) to an actual text value. Try inserting Msgbox statements or
writing the values to the Immediate Window with Debug.Print, for example:

MsgBox "MyControl = " & Me!MyControl

Hope that helps.
Sprinks

:

......The first form has a subform linked by the BAA/RFP/RFI Number. The
second form should be opening the record with the same info in the three
fields that appear on the subform. I almost got the code to work but I keep
getting an error that says "type Mismatch" What now?

:

Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

:

I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

:

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
M

mikek

I have multiple forms that Dumto multipe tables all with auto number keys.
Ihave set up multiple command buttons that that send you to diffrent forms
base on responces in the form. however whn the command button is hit the
next form that opens up is not the same record . how do I fix.

Sprinks said:
Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

Brandie said:
The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
S

Sprinks

Brandie,

First, you are making a common error in misunderstanding fields and controls.

Fields are *table* objects that have a datatype. Fields don’t exist on a
form—controls do. Controls may be unbound, be a calculation, or be bound to
a field in the form’s underlying RecordSource. The controls themselves do
not have a data type, they are merely a “container†to display the
ControlSource.

This is important because the Openform method statement uses an SQL WHERE
clause, which is defined in the stLinkCriteria assignment statement.

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

It is matching a *field* in the RecordSource of the form to be opened with
the value of a *control* in your subform. This is why I asked for the
fieldtypes (as shown in Table Design view) of the fields in the RecordSource
of the 2nd form. Your type mismatch error must be caused by at least one of
three expressions having differing datatypes on either side of the expression.

Use a MsgBox statement at the top of the command button code to display the
values of the three controls. Be careful to use the name of the control, not
the bound field; these may be different:

MsgBox Me![Control1] & “ “ & Me![Control2] & “ “ & Me![Control3]

Open the 2nd form’s RecordSource, and check these values against the
datatypes of the corresponding fields.

Hope that helps.
Sprinks

Sprinks said:
Brandie,

OK, got it now.

Please post:

- the name of your subform
- the ControlSource of each of the 3 subform controls you want to use as
matching criteria
- the Bound Column & the RowSource properties of any combo boxes on your
subform
- the field types of each of the corresponding fields in the RecordSource of
the second form
- the location of the command button that opens the second form. Is it on
the main form or the subform?

Sprinks
Brandie said:
Misunderstanding.....the main form has one subform with a command button that
opens another form (it isn't a second subform). I think I got it if you can
tell me how to get rid of the type mismatch error, but I'm not sure.

Sprinks said:
Brandie,

I think the easiest way to implement this, requiring no code, is to place
your second subform as a subform on your first, rather than on the main form.
Link the two on all three fields, and they should always display the related
information.

"Type mismatch" occurs when expressions on opposite sides of an equal sign
are of different types. As I posted, this is probably due to trying to
equate the value of a combo box (which may *display* text, but actually *be*
a number) to an actual text value. Try inserting Msgbox statements or
writing the values to the Immediate Window with Debug.Print, for example:

MsgBox "MyControl = " & Me!MyControl

Hope that helps.
Sprinks

:

......The first form has a subform linked by the BAA/RFP/RFI Number. The
second form should be opening the record with the same info in the three
fields that appear on the subform. I almost got the code to work but I keep
getting an error that says "type Mismatch" What now?

:

Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

:

I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

:

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
B

Brandie

I tried it exactly how you have it here and inside of parentheses and
quotatioins, the fist showed nothing but the original error and the second
just shows this:
MsgBox Me![Control1] & “ “ & Me![Control2] & “ “ & Me![Control3]

I'm so confused......


Sprinks said:
Brandie,

First, you are making a common error in misunderstanding fields and controls.

Fields are *table* objects that have a datatype. Fields don’t exist on a
form—controls do. Controls may be unbound, be a calculation, or be bound to
a field in the form’s underlying RecordSource. The controls themselves do
not have a data type, they are merely a “container†to display the
ControlSource.

This is important because the Openform method statement uses an SQL WHERE
clause, which is defined in the stLinkCriteria assignment statement.

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

It is matching a *field* in the RecordSource of the form to be opened with
the value of a *control* in your subform. This is why I asked for the
fieldtypes (as shown in Table Design view) of the fields in the RecordSource
of the 2nd form. Your type mismatch error must be caused by at least one of
three expressions having differing datatypes on either side of the expression.

Use a MsgBox statement at the top of the command button code to display the
values of the three controls. Be careful to use the name of the control, not
the bound field; these may be different:

MsgBox Me![Control1] & “ “ & Me![Control2] & “ “ & Me![Control3]

Open the 2nd form’s RecordSource, and check these values against the
datatypes of the corresponding fields.

Hope that helps.
Sprinks

Sprinks said:
Brandie,

OK, got it now.

Please post:

- the name of your subform
- the ControlSource of each of the 3 subform controls you want to use as
matching criteria
- the Bound Column & the RowSource properties of any combo boxes on your
subform
- the field types of each of the corresponding fields in the RecordSource of
the second form
- the location of the command button that opens the second form. Is it on
the main form or the subform?

Sprinks
Brandie said:
Misunderstanding.....the main form has one subform with a command button that
opens another form (it isn't a second subform). I think I got it if you can
tell me how to get rid of the type mismatch error, but I'm not sure.

:

Brandie,

I think the easiest way to implement this, requiring no code, is to place
your second subform as a subform on your first, rather than on the main form.
Link the two on all three fields, and they should always display the related
information.

"Type mismatch" occurs when expressions on opposite sides of an equal sign
are of different types. As I posted, this is probably due to trying to
equate the value of a combo box (which may *display* text, but actually *be*
a number) to an actual text value. Try inserting Msgbox statements or
writing the values to the Immediate Window with Debug.Print, for example:

MsgBox "MyControl = " & Me!MyControl

Hope that helps.
Sprinks

:

......The first form has a subform linked by the BAA/RFP/RFI Number. The
second form should be opening the record with the same info in the three
fields that appear on the subform. I almost got the code to work but I keep
getting an error that says "type Mismatch" What now?

:

Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

:

I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

:

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
S

Sprinks

Sorry you're having trouble, Brandie. Access can be somewhat frustrating in
the beginning.

Please cut and paste your entire command button event procedure, and I'll
see if I can help.

Sprinks

Brandie said:
I tried it exactly how you have it here and inside of parentheses and
quotatioins, the fist showed nothing but the original error and the second
just shows this:
MsgBox Me![Control1] & “ “ & Me![Control2] & “ “ & Me![Control3]

I'm so confused......


Sprinks said:
Brandie,

First, you are making a common error in misunderstanding fields and controls.

Fields are *table* objects that have a datatype. Fields don’t exist on a
form—controls do. Controls may be unbound, be a calculation, or be bound to
a field in the form’s underlying RecordSource. The controls themselves do
not have a data type, they are merely a “container†to display the
ControlSource.

This is important because the Openform method statement uses an SQL WHERE
clause, which is defined in the stLinkCriteria assignment statement.

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

It is matching a *field* in the RecordSource of the form to be opened with
the value of a *control* in your subform. This is why I asked for the
fieldtypes (as shown in Table Design view) of the fields in the RecordSource
of the 2nd form. Your type mismatch error must be caused by at least one of
three expressions having differing datatypes on either side of the expression.

Use a MsgBox statement at the top of the command button code to display the
values of the three controls. Be careful to use the name of the control, not
the bound field; these may be different:

MsgBox Me![Control1] & “ “ & Me![Control2] & “ “ & Me![Control3]

Open the 2nd form’s RecordSource, and check these values against the
datatypes of the corresponding fields.

Hope that helps.
Sprinks

Sprinks said:
Brandie,

OK, got it now.

Please post:

- the name of your subform
- the ControlSource of each of the 3 subform controls you want to use as
matching criteria
- the Bound Column & the RowSource properties of any combo boxes on your
subform
- the field types of each of the corresponding fields in the RecordSource of
the second form
- the location of the command button that opens the second form. Is it on
the main form or the subform?

Sprinks
:

Misunderstanding.....the main form has one subform with a command button that
opens another form (it isn't a second subform). I think I got it if you can
tell me how to get rid of the type mismatch error, but I'm not sure.

:

Brandie,

I think the easiest way to implement this, requiring no code, is to place
your second subform as a subform on your first, rather than on the main form.
Link the two on all three fields, and they should always display the related
information.

"Type mismatch" occurs when expressions on opposite sides of an equal sign
are of different types. As I posted, this is probably due to trying to
equate the value of a combo box (which may *display* text, but actually *be*
a number) to an actual text value. Try inserting Msgbox statements or
writing the values to the Immediate Window with Debug.Print, for example:

MsgBox "MyControl = " & Me!MyControl

Hope that helps.
Sprinks

:

......The first form has a subform linked by the BAA/RFP/RFI Number. The
second form should be opening the record with the same info in the three
fields that appear on the subform. I almost got the code to work but I keep
getting an error that says "type Mismatch" What now?

:

Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

:

I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

:

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 
B

Brandie

Private Sub Command93_Click()
On Error GoTo Err_Command93_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmDARPAeval"
MsgBox Me![BAA/RFP/RFI Number] & “ And “ & Me![Subject] & “ And “ &
Me![Candidate Technology]
stLinkCriteria = "[BAA/RFP/RFI Number]=" & Me![BAA/RFP/RFI Number] & "
AND [Subject]=" & Me![Subject] & "" And [Candidate Technology] = " &
Me![Candidate Technology]"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command93_Click:
Exit Sub

Err_Command93_Click:
MsgBox Err.Description
Resume Exit_Command93_Click

End Sub

Sprinks said:
Sorry you're having trouble, Brandie. Access can be somewhat frustrating in
the beginning.

Please cut and paste your entire command button event procedure, and I'll
see if I can help.

Sprinks

Brandie said:
I tried it exactly how you have it here and inside of parentheses and
quotatioins, the fist showed nothing but the original error and the second
just shows this:
MsgBox Me![Control1] & “ “ & Me![Control2] & “ “ & Me![Control3]

I'm so confused......


Sprinks said:
Brandie,

First, you are making a common error in misunderstanding fields and controls.

Fields are *table* objects that have a datatype. Fields don’t exist on a
form—controls do. Controls may be unbound, be a calculation, or be bound to
a field in the form’s underlying RecordSource. The controls themselves do
not have a data type, they are merely a “container†to display the
ControlSource.

This is important because the Openform method statement uses an SQL WHERE
clause, which is defined in the stLinkCriteria assignment statement.

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

It is matching a *field* in the RecordSource of the form to be opened with
the value of a *control* in your subform. This is why I asked for the
fieldtypes (as shown in Table Design view) of the fields in the RecordSource
of the 2nd form. Your type mismatch error must be caused by at least one of
three expressions having differing datatypes on either side of the expression.

Use a MsgBox statement at the top of the command button code to display the
values of the three controls. Be careful to use the name of the control, not
the bound field; these may be different:

MsgBox Me![Control1] & “ “ & Me![Control2] & “ “ & Me![Control3]

Open the 2nd form’s RecordSource, and check these values against the
datatypes of the corresponding fields.

Hope that helps.
Sprinks

:

Brandie,

OK, got it now.

Please post:

- the name of your subform
- the ControlSource of each of the 3 subform controls you want to use as
matching criteria
- the Bound Column & the RowSource properties of any combo boxes on your
subform
- the field types of each of the corresponding fields in the RecordSource of
the second form
- the location of the command button that opens the second form. Is it on
the main form or the subform?

Sprinks
:

Misunderstanding.....the main form has one subform with a command button that
opens another form (it isn't a second subform). I think I got it if you can
tell me how to get rid of the type mismatch error, but I'm not sure.

:

Brandie,

I think the easiest way to implement this, requiring no code, is to place
your second subform as a subform on your first, rather than on the main form.
Link the two on all three fields, and they should always display the related
information.

"Type mismatch" occurs when expressions on opposite sides of an equal sign
are of different types. As I posted, this is probably due to trying to
equate the value of a combo box (which may *display* text, but actually *be*
a number) to an actual text value. Try inserting Msgbox statements or
writing the values to the Immediate Window with Debug.Print, for example:

MsgBox "MyControl = " & Me!MyControl

Hope that helps.
Sprinks

:

......The first form has a subform linked by the BAA/RFP/RFI Number. The
second form should be opening the record with the same info in the three
fields that appear on the subform. I almost got the code to work but I keep
getting an error that says "type Mismatch" What now?

:

Hi, Brandie.

These subforms--are they linked to the main form, that is, have you set the
LinkMasterFields and LinkChildFields properties of each subform? If they
were linked by the three fields you mention, you wouldn't need *any* code,
they would simply display the appropriate records.

Hope that helps.
Sprinks

:

I figured out why it changed back and fixed it...but now it doesn't work at
all. I think it has something to do with the fact that subject and
technology are on a subform on the first form. The way that I had before
worked it just tried to create a new record instead of saving the info on the
same one. and it showed the autonumber ID of the subject and technology
instead of the word. Do i have to do something different in the filter if
the info is on a subform?

:

Hi, Brandie.

This is an example of why most developers prefer a simple AutoNumber primary
key rather than one made of multiple fields. It makes life easier.

In any case, use the wizard and then modify the stLinkCriteria assignment to
include all your criteria:

stLinkCriteria = "[Field1]=" & Me![Control1] & " AND [Field2]=" &
Me![Control2] & " AND [Field3]=" & Me![Control3]

Hope that helps.
Sprinks

:

The first form has a record and in that record there are look ups to the
subject table and the technology table. These and the Project Number make up
the primary key for the main table(all three). The second form runs off a
query that runs off of the main table. When I enter information into the
first form and click on the comand button, it saves the form and opens the
second. I need the second form to display the first three fields acording to
the record shown on the first form(i.e.it
needs to be the same record). How do I do this?

I tried, in the second form, setting the default value property of the 3
controls to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

This works, but when saving the second form, it trys to create a new record
instead of it being the same record as the one on the first form. Please
help, this is driving me crazy. And please don't say use the wizard...I've
tried that and it only uses one control to link forms, not three.
 

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