Finding a matching text string.

F

Frank Martin

I have a blank form FrmBF containing two
unrelated subforms "SubA" and "SubB".

SubA & SubB are unrelated too.

SubA has a text field named "TextA".
SubB has a text field named "TextB"

When I select a value "TextA" in SubA I
want a record selected in SubB containing
its identical string in TextB.

Can this be done with a macro, or do I need
code for it?

Can someone help me solve this problem?

Frank
 
A

Arvin Meyer [MVP]

Actually code is easier. In the AfterUpdate event of TextA, write an [Event
Procedure] by choosing the in the drop-down, and then clicking the ellipses
button (...). Now type the following in the code window:

Private Sub TextA_AfterUpdate()
Me.Parent.SubB.TextB = Me.TextA
End Sub

That's it!
 
S

Steve Schapel

Frank,

When I first saw your question, I thought it was the same one that
people have been offering to help you with in various other newsgroups,
but whose suggestions you have consistently ignored.

But now I see it is a different question.

The easiest way to do this, in my opinion, is neither macro nor VBA
procedure. I would do it like this:
1. Put an unbound textbox on the main form.
2. Set its ControlSource like this:
=[SubA]![TextA]
3. Set the Link Child Fileds property of SubB to:
[TextB]
.... and its Link Master Fields property to:
[the name of the textbox as per step 1]
 
F

Frank Martin

Eureka! Thank you, this worked. I had tried
roughly this method before but made the
mistake of making the master the field in the
subform instead of the main-form text box.
Gratefully, Frank


in message
Frank,

When I first saw your question, I thought
it was the same one that people have been
offering to help you with in various other
newsgroups, but whose suggestions you have
consistently ignored.

But now I see it is a different question.

The easiest way to do this, in my opinion,
is neither macro nor VBA procedure. I
would do it like this:
1. Put an unbound textbox on the main
form.
2. Set its ControlSource like this:
=[SubA]![TextA]
3. Set the Link Child Fileds property of
SubB to:
[TextB]
... and its Link Master Fields property to:
[the name of the textbox as per step 1]

--
Steve Schapel, Microsoft Access MVP

Frank said:
I have a blank form FrmBF containing two
unrelated subforms "SubA" and "SubB".

SubA & SubB are unrelated too.

SubA has a text field named "TextA".
SubB has a text field named "TextB"

When I select a value "TextA" in SubA I
want a record selected in SubB containing
its identical string in TextB.

Can this be done with a macro, or do I
need code for it?

Can someone help me solve this problem?

Frank
 
F

Frank Martin

Thanks, but this didn't work. Do I have to
make adjustments because these are text
fields?
The "AfterUpdate" event produces no results.
Also I get this error on the "on exit" event.
"Object doesn't support this property or
method."
Regards


message
Actually code is easier. In the AfterUpdate
event of TextA, write an [Event Procedure]
by choosing the in the drop-down, and then
clicking the ellipses button (...). Now
type the following in the code window:

Private Sub TextA_AfterUpdate()
Me.Parent.SubB.TThanks, extB = Me.TextA
End Sub

That's it!
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


message
I have a blank form FrmBF containing two
unrelated subforms "SubA" and "SubB".

SubA & SubB are unrelated too.

SubA has a text field named "TextA".
SubB has a text field named "TextB"

When I select a value "TextA" in SubA I
want a record selected in SubB containing
its identical string in TextB.

Can this be done with a macro, or do I
need code for it?

Can someone help me solve this problem?

Frank
 

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