Programmaticaly get a record from a subform embedded in a main for

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,

The background:

I have a Search Screen which involves a main form (unbound) with a few
controls to define search criteria, and a subform embedded in the main form
where the results of the search are listed.

The problem:

I would like to click on a row in the results list and be able to get
information on the row I have clicked. What I mean is to use an event
associated with clicking on a subform embedded in a main form, and inside the
event coding, I would like to find out on what row of the subform itwas
clicked.

Thank you very much in advance !
 
Do you want to display it in a form or report that is open following the
click event?
Create an unbound TextBox and use the below as TextBox source in the form or
report.
[Forms]![YourMainForm]![YourSubForm]![YourDataField]
 
Hi Karl,

Thank you for your response.

What I need is something slightly different. I have probably not described
what I want very well. Let me try again.

I have a main form which is basically a Search Form. This is an unbound form
with some text boxes to allow user to specify search criteria -e.g. say there
is a customer table so the text boxes allow the user to enter a 'last name'
to search all the customers with that last name. The main from has a button
that the user uses to execute the search.

The result of the search is basically a list of records -e.g. all customers
with the same last name. The results are listed in a subform with the default
display set to data sheet. So basically it looks like a spreadsheet.

Say the user clicks on one of the rows of the results -i.e. it clicks on a
row of the subform. First question is: what event and of what object should I
use to capture the fact that a user has clicked on a row of the subform ?.
The second question is: in the implementation of the event in the previous
question, how do I determine what row the user has clicked on ?.

The motivation for the questions is the following. If I can determine
programaticaly what row (record) a user has clicked on, I could bring a form
-say the customer form, for that particular customer.

I hope this makes more sense now.

Thank you very much !
Fernando
--
Fernando


KARL DEWEY said:
Do you want to display it in a form or report that is open following the
click event?
Create an unbound TextBox and use the below as TextBox source in the form or
report.
[Forms]![YourMainForm]![YourSubForm]![YourDataField]

Fernando said:
Hi there,

The background:

I have a Search Screen which involves a main form (unbound) with a few
controls to define search criteria, and a subform embedded in the main form
where the results of the search are listed.

The problem:

I would like to click on a row in the results list and be able to get
information on the row I have clicked. What I mean is to use an event
associated with clicking on a subform embedded in a main form, and inside the
event coding, I would like to find out on what row of the subform itwas
clicked.

Thank you very much in advance !
 
how do I determine what row the user has clicked on ?.
Rows os datasheet have no identification other than the data contained in
their fields.What I gave you will do this.
Also you can just use a mainform that has an unbound ListBox or ComboBox to
select the customer. Then have the subform (your customer form) query to use
the results of the unbound ListBox or ComboBox as criteria.

Fernando said:
Hi Karl,

Thank you for your response.

What I need is something slightly different. I have probably not described
what I want very well. Let me try again.

I have a main form which is basically a Search Form. This is an unbound form
with some text boxes to allow user to specify search criteria -e.g. say there
is a customer table so the text boxes allow the user to enter a 'last name'
to search all the customers with that last name. The main from has a button
that the user uses to execute the search.

The result of the search is basically a list of records -e.g. all customers
with the same last name. The results are listed in a subform with the default
display set to data sheet. So basically it looks like a spreadsheet.

Say the user clicks on one of the rows of the results -i.e. it clicks on a
row of the subform. First question is: what event and of what object should I
use to capture the fact that a user has clicked on a row of the subform ?.
The second question is: in the implementation of the event in the previous
question, how do I determine what row the user has clicked on ?.

The motivation for the questions is the following. If I can determine
programaticaly what row (record) a user has clicked on, I could bring a form
-say the customer form, for that particular customer.

I hope this makes more sense now.

Thank you very much !
Fernando
--
Fernando


KARL DEWEY said:
Do you want to display it in a form or report that is open following the
click event?
Create an unbound TextBox and use the below as TextBox source in the form or
report.
[Forms]![YourMainForm]![YourSubForm]![YourDataField]

Fernando said:
Hi there,

The background:

I have a Search Screen which involves a main form (unbound) with a few
controls to define search criteria, and a subform embedded in the main form
where the results of the search are listed.

The problem:

I would like to click on a row in the results list and be able to get
information on the row I have clicked. What I mean is to use an event
associated with clicking on a subform embedded in a main form, and inside the
event coding, I would like to find out on what row of the subform itwas
clicked.

Thank you very much in advance !
 
it Hi Karl,

You are absolutely right. The idea of a form with a list box was suggested
by Klatuu (sorry I've fired 2 threads by mistake) I tried it and it works as
I wanted. Thanks for your help.

Cheers
--
Fernando


KARL DEWEY said:
Rows os datasheet have no identification other than the data contained in
their fields.What I gave you will do this.
Also you can just use a mainform that has an unbound ListBox or ComboBox to
select the customer. Then have the subform (your customer form) query to use
the results of the unbound ListBox or ComboBox as criteria.

Fernando said:
Hi Karl,

Thank you for your response.

What I need is something slightly different. I have probably not described
what I want very well. Let me try again.

I have a main form which is basically a Search Form. This is an unbound form
with some text boxes to allow user to specify search criteria -e.g. say there
is a customer table so the text boxes allow the user to enter a 'last name'
to search all the customers with that last name. The main from has a button
that the user uses to execute the search.

The result of the search is basically a list of records -e.g. all customers
with the same last name. The results are listed in a subform with the default
display set to data sheet. So basically it looks like a spreadsheet.

Say the user clicks on one of the rows of the results -i.e. it clicks on a
row of the subform. First question is: what event and of what object should I
use to capture the fact that a user has clicked on a row of the subform ?.
The second question is: in the implementation of the event in the previous
question, how do I determine what row the user has clicked on ?.

The motivation for the questions is the following. If I can determine
programaticaly what row (record) a user has clicked on, I could bring a form
-say the customer form, for that particular customer.

I hope this makes more sense now.

Thank you very much !
Fernando
--
Fernando


KARL DEWEY said:
Do you want to display it in a form or report that is open following the
click event?
Create an unbound TextBox and use the below as TextBox source in the form or
report.
[Forms]![YourMainForm]![YourSubForm]![YourDataField]

:

Hi there,

The background:

I have a Search Screen which involves a main form (unbound) with a few
controls to define search criteria, and a subform embedded in the main form
where the results of the search are listed.

The problem:

I would like to click on a row in the results list and be able to get
information on the row I have clicked. What I mean is to use an event
associated with clicking on a subform embedded in a main form, and inside the
event coding, I would like to find out on what row of the subform itwas
clicked.

Thank you very much in advance !
 
Back
Top