Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, 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.

Using Sql To Fill In Database Forms

  • Please log in to reply
1 reply to this topic

#1 Guest_danbrownlow_*


  • Guests

Posted 03 April 2008 - 07:21 AM

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 =]


BC AdBot (Login to Remove)


#2 tos226



  • Members
  • 1,578 posts
  • Gender:Female
  • Location:LocalHost

Posted 04 April 2008 - 09:17 PM

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.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users