BleepingComputer.com: Using Sql To Fill In Database Forms

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Using Sql To Fill In Database Forms Need some help, google yeilded nothing useful

#1 User is offline   danbrownlow 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 99
  • Joined: 05-March 07
  • Gender:Male

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

Dan.

#2 User is offline   tos226 

  • BleepIN--BleepOUT
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 1,423
  • Joined: 21-October 04
  • 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.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users