Unanswered: Nearly finished a DB - Need a little help...
I was wondering whether someone could help me. I’ve been working extremely hard on a relational database for a small car hire company. Anyway, I’ve nearly finished the database now but I have a problem. On a form I have created called ‘Customer’, I have a text box entitled, ‘txtDrivingLicenceNumber’. This takes data from a field called ‘DrivingLicenceNumber’ from a table called ‘Customer’. What I need is, when you click a button called ‘Add Rental’ (the button should be called cmdAddRental), a new record should be created in a form entitled, ‘Rents’, BUT the driving licence number should ALSO be carried over into the new record in the Rents form and displayed on the screen in a text box. Does anyone know how to do this?
Secondly, I have created a text box called, ‘txtSettled’ on the Rents form. This Y or N flag is my trap to re-find a customer by searching for rentals from a Main Menu form based on their driving licence number. Only if the driving licence number matches AND the settled flag is set to N would a record be returned, all the rest would be previous settled hires.
Does anyone have any idea how to do either of these? ANY help would be very much appreciated.
The OpenArgs property of the opening form takes the value you passed in the OpenArgs argument of the OpenForm method.
When the 'Rents' form is opening, you can use the form's OpenArgs property to assign the value to the text box in 'Rents' form:
txtDrivingLicenceNumber = OpenArgs
If you wish to return the record(s) in a continuous form, use WhereCondition argument of the OpenForm method. The syntax of WhereCondition argument is just like a WHERE clause of an SQL statement, but without the WHERE keyword. You can use this:
Thank you for kindly helping with this. I've just tried the first of your two points. In my Customer form I have the text box called, 'txtDrivingLicenceNumber' and in my Rents form I have the text box called, 'txtDrivingLicenceNumberRents'. I want the data from the Customer form (txtDrivingLicenceNumber) to be displayed in the Rents form (txtDrivingLicenceNumberRents) when the Add Rental button is clicked. I've made the button and added this code to the Customer form in the Form Open method...