Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View ID details on Double Click 1

Status
Not open for further replies.

Phudsen

Technical User
Mar 7, 2003
136
A2
Hi all,

I have three tabular forms each one appears on a different condition. I don't have a problem with that. The three forms have a field called SubjectId. When the user double clicks the subject ID he/she will find the details. Do do that, I made for each form, 1 query and 1 forms because the query will read from the opened form, I did that using the build command in the query.

Is it possible to make 1 form and one query for all forms instead of 3 forms and 3 queries. No matter which tabular form is open. When the SubjectID field is clicked, the form with details will open.

Let's say that I have Form1, Form2, Form3. For each of these forms I made 1 query to read the double click on the subjectID field and get the details for that subjectID and a form to view the results of the query.

How to make one form to open the details of the subjectID wherever it is double clicked.


Thanks a lot
Paulin
 
How are ya Phudsen . . . . .

That depends on you table structure & relationships of which we here have no Idea. [purple]You need to post these items![/purple] Please Include PKs, FKs.

Also, if your calling up the same details according to SubjectId on each form, [purple]whats the difference in the content of the forms?[/purple]

cal.gif
See Ya! . . . . . .
 
Hi,

Thank you AceMan for your reply.

1- One form is for Data entry, when I enter many SubjectIDs I can click an ID to change or read what are the details. The second is to Acutally edit Papage number which has many subject IDs, I click on the SubjectID to edit details or just to know. The third one is to view a paper using PaperMaster and PaperDetails, when I click on the SubjectID I get the results.

2- The subject ID takes the details from the subjects table. which has SubjectID (PK), and the SubjectID is available in the PaperDetails tables as (FK).

After I made 3 queries and 3 forms it is working fine, but I feel that this is a wrong approach.

Thank you AceMan
Paulin
 
Hi Again Aceman,

My situation is like when you have info on cars:
1 form to display cars with fines
1 form to display cars that have had accidents
1 form to display cars with cetrain brand

each of the above forms has a field called plate number, I want to double click the plate number and get information about the car and the owner, his address ...etc. How to do that? In any of the above separate forms click the plate number and get the details.

This example is to further explain my problem.

Paulin
 
Hi again AceMan,

Is there any command to put in the query to read the SubjectID field from the Current Opened Object? So, no matter which form is opened.

Example in the query criteria:
=OpenedObject.SubjectID
Note: Each form has a form and a subform.


Thanks a lot.

 
OK Phudsen! . . . .

Sorry to get back so late. Got tied up with kids this weekend. So . . . . . lets do this (you have to supply anything in [purple]purple[/purple] . . . .

First you only need one Form & Quey.

In the [blue]Criteria[/blue] line of the query, for [blue]SubjectId[/blue], add the following:
Code:
[blue]Val([Forms]![[purple]YourDetailFormName[/purple]].[OpenArgs])[/blue]
Next, in the [blue]DoubleClick Event[/blue] for [blue]SubjectId[/blue] of each of the three forms, add the following line:
Code:
[blue]docmd.OpenForm "[purple]YourDetailFormName[/purple]",,,,,,str(Me![b]SubjectId[/b])[/blue]
Thats it! . . . . Give it a whirl & let me know . . . .

cal.gif
See Ya! . . . . . .
 
Hi AceMan,

It worked fine thank you. But, here in the query I have to mention the form name. Each form has a different name. So, this will work only with the form that is mentioned in the query. Is there anything like OpenArgs to denote an object, I mean something like OpenForm?

Val([Forms]![YourDetailFormName].[OpenArgs])
This will work with the form name I put here.
Val([Forms]![frmSubjectListing].[OpenArgs])

Each form has a different name.

Thanks a lot
Paulin
 
Hi AceMan,

I used Screen.ActiveForm instead of form name and it worked fine.

Thank you for your help which guided me to the right thing.

Thanks a lot
Paulin
 
Phudsen . . . .

Hmmmmm . . . . . How'd I know you'd be back! ;-)

[Blue]Screen.ActiveForm[/blue] wont work, nither will [blue]Screen.ActiveForm.Name[/blue].

First, understand, [purple]YourDetailFormName[/purple] is the name of the common form called by the other three. [purple]You do not need to worry about the other three form names[/purple], since, according to you, the dependency strictly involves [purple]SubjectId[/purple].

Here's whats happening:

The last arguement of [blue]DoCmd.OpenForm[/blue] is called the [purple]OpenArg Property[/purple] (thats OpenArguement). Its used to pass a string to the form you are opening (this accounts for number to string conversion [purple]str(Me!SubjectId)[/purple].

When the form opens, the query uses the [purple]OpenArg Property[/purple] as part of the critetia to filter the records. Note the conversion back to numeric with [purple]Val([Forms]![YourDetailFormName].[OpenArgs])[/purple].

All thats happening is were passing [purple]SubjectId[/purple] to the common form when it opens, where its used in the query to set the criteria.

So . . . . replace [purple]YourDetailFormName[/purple] with the name of the common form thats opened and call it a day.
Again, now you only need the one common form, You can delete the others.

If this is not the case, and there's some dependcy on form names, then your talking a different secnario and need to apprise as such.

I hope this clears the way for ya!




cal.gif
See Ya! . . . . . .
 
Hi IceMan,

That's correct, I missed that.

Yes, each form is calling the "ONE" form which displays the details.

Thanks a lot IceMan :)
Paulin
 
Hi AceMan,

What I meant with my question is:

In the Criteria of the Query, do I have to put the form name that will open or the form name which has the double click field?

This is what I meant, the query not the double click. I know there you can put only the form name. But what about the query. The query should have the source of the criteria in order to open the detailed form.

Thanks
Paulin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top