Access 2013 41 - Passing Values Between Forms

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
a locked Access 2013 tutorials in this video I'm going to be showing you how you can pass values between forms so if you wanna play long for link below the video to the download section website and download this Access 2013 DB 41 and we're I don't know how far through creating a booking system for a hotel in the last video we added this button here which is add charge and whenever we click on that we get returned at the moment the booking detail ID and what we want to do is we're going to create a form for a table X of charges and we're going to pass over that booking detail ID and we're going to set that value within the form so that when we add a charge we add it to the relevant booking detail ID okay how do we do that well first of all we need to actually create let's close that we need to create that form so say what let's go to form rooms data entry okay so I click on forms data entry control C control V and call it form extra charges data entry and obviously we need to do some changes or make some changes so drop into design view press f4 got a full map call it extra charges and pressing the control button and I'll click in on all of the controls and I'm going to delete all of them when I go to data record source and I'm going to change it to table extra charges now what I'm going to do now I've change the records also before I'm going to add to the correct record source so I'm going to click on next charges ID and click and drag it and same with day and candy tails ID item and a melt ice merge themselves and we're going to press on these buttons here so start with this button I'm just going to change this to form extra charges data entry here same again form extra charges data entry and same again here okay as I started I put it in layout view so this is what we got so everything's fine except this booking details ID so what we want to do just grab the booking details I didn't drop it to the bottom so knowing can't get rid of that so we end up with something like that now we're actually going to make this not visible at some point but for now we're going to leave it blank so there's our form that we want to open up so close that and let us go to form bookings extended DF and we don't even need to get a datasheet view just click on charge press f4 go to event and go to the macro so first things first we're going to open up the form it's a very simple open form form I've got on a name extra charges data entry we wanted to open up in dialog view and let's start with edit for now so we're not doing anything I'll keep doing that then we'll do anything special you click on that charge and you get the extra charges form that's fine so now press f4 let's change that to add save and close so now when we click on it it's opened in add mode so now what we want to do is we want to actually pass the booking details ID over so press escape and close that and we'll do this by way of a temporary variable so under here tap in set template variable and name temp booking detail ID and expression equals booking detail ID and just click on it and drag it to the top so it sets the temporary variable before opening the form otherwise when you open the form well you're not passing any values are you and press control-c the temping detail ID save and close that so now we go to form extra charges data entry and open it in layout view go to form event and we want the onload event of the form so we're clicking the three dots so when the form loads up we want it to actually take that booking or that temporary variable and whatever value is in the temporary variable sign it to booking detail ID but first we need to check if and data entry equals true so that means if it's been opened in add mode so you want to add some information and remeasured another one if not is null Templars temp booking detail ID set property booking details idfk value equals Templars only one equal sign please okay so that's what you need to tap in so the first if statement checks whether it's in add mode if it is the second if statement checks that that temporary variable actually has a value and if it does the action takes the value of the temporary variable adds at the booking details ID why not oh I need a comma comma bracket or am I talking about okay so close that aside back and close that so in order to make sure this is working correctly unhide or digestive unhide fields and unhide booking details I didn't guess cuz I'll just hit that so it's just made a bit smaller like for example the first one would be 7 so booking details ID 7 so if we then click an item I say lunch and say I don't know $12 save that that's now been added to the table and this one here is number 9 so I pass taking this value add an enter here and that's given number 9 TV package which is 20 350 and save that ok so any other things worth doing let's hide that again don't see that and will also hide the field on the form extra charge data entry for visible nope okay so that's how you can pass values between forms with the use of temporary variables it is important to check for the existence of those variables before you assign them and I think that's it or shall I be really picky let's be really picky open up for muggings extended D s go to event and control C and under here let's actually remove that temporary variable not remove all temper variables just remove temp variable so that once it's opened up and dialogue mode one says we close it that's actually removed okay that's being ever so slightly picky okay right so that's the video thank you for watching and hope to see you next one good bye
Info
Channel: Access All In One
Views: 95,980
Rating: 4.5294118 out of 5
Keywords: Microsoft Access (Software), MS Access Tutorial, microsoft access tutorial, What is MS Access, What is MS Access used for, Access 2013 Tutorial, MS Access, Access, Access Database tutorial, Training, Tutorial, Software, Download, How-To, Class, Classes, Course, Microsoft, MS, Tips, Help, Programs, Educational, Relational Database, Temporary Variables, DataEntry, IsNull, OpenForm Macro Action
Id: eqkGPfIUUxE
Channel Id: undefined
Length: 8min 43sec (523 seconds)
Published: Thu Jul 04 2013
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.