Computer Help and Spyware Removal Computer Help and Spyware Removal Computer Help and Spyware Removal Computer Help Forums Windows Startup Programs Database Spyware and Malware Removal Guides Computer Tutorials Uninstall Database File Database Computer Glossary Computer Resources
 

Welcome Guest ( Log In | Click here to Register a free account now! )



Register a free account to unlock additional features at BleepingComputer.com
Welcome to Bleeping Computer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.
Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

 
Reply to this topicStart new topic
> Using Sql To Fill In Database Forms, Need some help, google yeilded nothing useful
danbrownlow
post Apr 3 2008, 07:21 AM
Post #1


Member
**

Group: Members
Posts: 84
Joined: 5-March 07
From: Brighton, UK
Member No.: 115,537



Hey there,
Well, I'm looking for a way to fill in some fields in a database automatically using SQL. I'll explain better:

Well, I'm making a video rental database. Each movie has a copyID with an hireband associated to it (The hireband determines how much the customer pays and how long they get the movie for). When the cashier enters the CopyID, I would like to be able to grab the hireband from the database then using something like an if statement to determine how long the movie can be rented for. So if for say:

They enter the CopyID as 'CO101', a piece of code (SQL), would get the HireID for the movie (which say is '1', this can be rented for 2 days) and then add 2 days to the current day (So if rented 3/4/2008, would calculate return as being 5/4/2008). I know how I could write the SQL, I'm just not sure how I get the field to automatically update itself with a query.

I'm not even sure this can be done in Access 2007, (which I'm required to use).

Any help would be great =]

Dan.
Go to the top of the page
 
+Quote Post
tos226
post Apr 4 2008, 09:17 PM
Post #2


Distinguished Member
*****

Group: Members
Posts: 949
Joined: 21-October 04
Member No.: 3,911



Assuming you have a table built, and even an entry form of some sort:
Something like this:
Into some field1 you'll enter a value.
You'll have another field2 on the form, and therefore in the database, which needs a calculation, right?

Right click field2 (in design mode of course). Select properties. Look at the Control source item.
There'll be ... 3 dots near it. Click the dots. Expression dialog opens.
Write your thing there and that's that. When you enter something into field1, field2 will update.
So on Monday you'll enter Code1, and field2 (due date) should calculate Wednesday based on the lookup from some other table (I presume) which shows the Codes schedule of returns.
You can use pre-built queries, calculations or a combination of both in the calculation.

Access is a powerhouse. Play a little and you'll see how it works.

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 7th September 2008 - 01:11 AM


Advertise   |   About Us   |   Terms of Use   |   Privacy Policy   |   Contact Us   |   Site Map   |   Chat   |   Tutorials   |   Uninstall List
Discussion Forums   |   The Computer Glossary   |   Resources   |   RSS Feeds   |   Startups   |   The File Database   |   Malware Removal Guides

© 2003-2008 All Rights Reserved Bleeping Computer LLC.