Query reults into a form...for Fornation (1 Viewer)

Son268

Registered User.
Local time
Today, 04:53
Joined
Mar 31, 2001
Messages
20
praise be!!

I have struggled long with this and finally a solution...thank-you (even though i didnt ask that particular question...

Now maybe there is something else that u can help me with (or any one else please)...When I run this particular search I have many returns to that query...can i get them all to display on that form, without having to scroll through? Also I would like to be able to click on one of the record returns for that query and move straight to that particular form so that it can be printed out. Any help would be greatly appreciated... many thanks, once again.

I guess that what I am really aiming at is a search form that returns the results on the same form, in tabular view (if possible)and then I click on one of the records and the corresponding form, for easier use, pops up....


thanks in advance,

Sonya B.
 

D-Fresh

Registered User.
Local time
Today, 04:53
Joined
Jun 6, 2000
Messages
225
I think your best bet would be to use a subform on your search form. Make the subform not visible. Then when your search is complete, you can make the subform visble by me("SubformName").visble = true.

On the subform itself, make sure you include some type of unique identifier. In that field, set the onClick event to open up your form for printing, setting the filter to uniquefield=[the record you clicked on]. A record number with a type set to Autonumber usually works best.

Hope that helps and let me know if you need anything else.

Doug
 

Son268

Registered User.
Local time
Today, 04:53
Joined
Mar 31, 2001
Messages
20
Hi there again...thank-you for ur speedy reply!

Could I trouble you to talk me through how to do that step by step please? Sorry but im still learning!!

Thankyou once again,

Sonya B.
 

D-Fresh

Registered User.
Local time
Today, 04:53
Joined
Jun 6, 2000
Messages
225
Sonya, get ready...


Alright, create a new form. On the properties sheet, Format tab, change the "Default View" to Datasheet. Use your query as the source. Throw the fields that you want to see on the form. You don't have to line them up or anything, in datasheet view, it'll list the columns in the Tab Order they're in. Like I said, I suggest you having an Autonumber field, as a record number. In design View, click on that Record Number control. Go to the properties sheet, Event tab, and select [Event Procedure] in the onClick event. In there, put the code...

docmd.openform "YourFormName", , "[Record_No]=" & me("Record_No")

This will open your form to where the Record_No matches the one you clicked on.

Save this form. Go to your form with the Search button and add a subform control to it. The control is in your toolbar before the line tool. Place it on your form and a wizard will pop up. Just select the form you just created and hit finish. Set the visible property to false for this subform in the properties sheet, Format Tab. Now after the code on your search button, put the following...

me("SubFormName").visible = true

This will make the subform visible after your search. That should be it. After your subform is visible, you can click on a record no and it should open up your big form to that record. Hope you got all that and Hope this helps...

Doug
 

Son268

Registered User.
Local time
Today, 04:53
Joined
Mar 31, 2001
Messages
20
Doug, thank you once again for your invaluable help.

However some confusion for me (sorry). This Autonumber field...how do I insert it? Do I go back to the main table and add a autonumber field? Also my company in its wisdom has only done a custom installation of access 97 and there is no wizard for subforms. However I think that I can create a subform and attach it using the drag and drop method. Do I set the parent/child linking fields to the field 'name'? (that is the field that I am searching for)

Sorry to be such a nuisance!!

Thank-you,

Sonya B.

PS I think that i will go back to the main table in the mean time and add an autonumber field.


[This message has been edited by Son268 (edited 06-06-2001).]
 

Son268

Registered User.
Local time
Today, 04:53
Joined
Mar 31, 2001
Messages
20
Doug,

I think that I have muddled through what u ask, however when i run the search it comes back with the following... 'compile error, variable not defined'. The code on my search button now reads....

Me.Requery
me(sbfrmsearch).visible=true

do you think maybe it was because i was unable to use the wizard to create the subform?

Thanks in advance.

Sonya B.
 

D-Fresh

Registered User.
Local time
Today, 04:53
Joined
Jun 6, 2000
Messages
225
I think your problem is how you're referring to the subform. There should be quotation marks around the name of the subform...

me("sbfrmsearch").visible=true

And with the parent and child links, you don't really have to worry about them... Those are only needed if you're going to relate specific data from the main form with the subform. In your case, the subform is just being used to select an item... How did everything else work out?

Doug
 

Fornatian

Dim Person
Local time
Today, 04:53
Joined
Sep 1, 2000
Messages
1,396
Thanks for the mention, but you 2 seem to have an interesting thread going here so I think I'll leave you to it.

Ian
 

Son268

Registered User.
Local time
Today, 04:53
Joined
Mar 31, 2001
Messages
20
hey Doug...

thanks for the reply but im off over the weekend (for once!!!) ha ha

I wil check this out next week... and once again thankyou thankyou thankyou.......I will get back to you in a few days, Obi Wan..........have a nice weekend and may the force be with u my friend!!!

Sonya B.
 

Users who are viewing this thread

Top Bottom