Access World Forums

Access World Forums (https://www.access-programmers.co.uk/forums/index.php)
-   Forms (https://www.access-programmers.co.uk/forums/forumdisplay.php?f=9)
-   -   Opening Specific Record from a List (https://www.access-programmers.co.uk/forums/showthread.php?t=292619)

navi95 03-15-2017 01:50 AM

Opening Specific Record from a List
 
Hi all!

Im back with another question!
Heres the basic outline:

I have created a booking application in Access and on my switchboard I have a subform which is based on a query which lists all my current bookings and has the following fields: Booking Nr, Customer ID, Name, Apartment etc.

Now...I would like to create a Button (which will appear in each line/record in the subform) once pressed, which will open up that record in a form so that I can make changes if needs be.

I was thinking along the lines of that the Button would make a TempVars? Using that, I can make the Form i want for editing to open based on the Tempvars value.

I hope you guys understand what I mean, if not, let me know and Ill make some screenshots to help illustrate what I mean.

Thanks!

Nav

Minty 03-15-2017 01:55 AM

Re: Opening Specific Record from a List
 
I would have a read here for a sensible solution http://baldyweb.com/wherecondition.htm

navi95 03-15-2017 01:57 AM

Re: Opening Specific Record from a List
 
That looks like exactly what I need!
I will have a play later on and let you guys know how I get on...thanks for the quick reply!

navi95 03-15-2017 02:31 AM

Re: Opening Specific Record from a List
 
I tried giving it a go...nothing came up. Not even an error asking to debug, which I was expecting since I wasnt sure if I had written the code correctly.

I even tried a simple 'docmd.openform "form_edit_booking" ' to see if the button works at all...that also didnt work. Ive checked other buttons on other forms, it seems fine, not sure why its not working on this subform though.

any thoughts`?

Minty 03-15-2017 03:18 AM

Re: Opening Specific Record from a List
 
Can you post up your exact code ?

Be aware that prefixing your forms with form_ is a not a good idea as access uses that naming structure internally for objects.

navi95 03-15-2017 03:43 AM

Re: Opening Specific Record from a List
 
Right, I have now got the button to at least open the form. I had to change Properties of the subform to allow edits, otherwise the button refused to work.

Now I will try the where condition out.

navi95 03-15-2017 05:01 AM

Re: Opening Specific Record from a List
 
Right, after figuring out why the Button wouldnt work, i had to change some of the properties of the subform, I actually went with the Tempvars solution.

So the button will create a tempvars called "bknr" and then opens the form using the tempvars as the default value for the booking number (form is based on a query)

Thanks for previous comments :)

Minty 03-15-2017 05:39 AM

Re: Opening Specific Record from a List
 
Glad you've sorted it out. Make sure you reset any tempvar's you might refer to anywhere else. I'm personally not a huge fan, and prefer to set variables per form to avoid forgetting where they are set and unset.

navi95 03-15-2017 05:41 AM

Re: Opening Specific Record from a List
 
I might checkout the wherecondition another time :)

Im happy its working, makes my life that little bit easier now in the database!

Thanks :)


All times are GMT -8. The time now is 03:24 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World