hi.,
i've got 3 tables, customer, film and filmrental.
i've got a customer form, with a sub form at the bottom, which is a film
rental subform.
i've created an update query, which when a filmid, is entered into the
subform, the 'available' check box in the film table, becomes false
(Unchecked). according to which filmID it is. heres the code, i;ve got in an
update query. "Available"=False
NOTE. it is not in VB, its just in the 'Update To' bit, in the design view.
this is all good, as it works.
how can i get it to do the opposite, when i delete a record, from the
subform? e.g. when the record is deleted, the checkbox becomes (Ticked) True
again?
tia
Dev 9 1688
"DP" <DP@hotmail.com> wrote in message
news:yw******************@newsfe5-gui.ntli.net... hi.,
i've got 3 tables, customer, film and filmrental.
i've got a customer form, with a sub form at the bottom, which is a film rental subform.
i've created an update query, which when a filmid, is entered into the subform, the 'available' check box in the film table, becomes false (Unchecked). according to which filmID it is. heres the code, i;ve got in an update query. "Available"=False
NOTE. it is not in VB, its just in the 'Update To' bit, in the design view.
this is all good, as it works.
how can i get it to do the opposite, when i delete a record, from the subform? e.g. when the record is deleted, the checkbox becomes (Ticked) True again?
tia
Dev
If the design of this database is as I understand, you simply add and delete
records from the filmrental table to model films being checked in and
checked out. Obviously this would leave you with no history of which
customers have rented which films - is that the intended design?
If so, then you don't need the field 'Available' in the films table as a
simple dlookup would tell you whether the film was in or out. Even with a
more sophisticated design, one could debate the pros and cons of having the
'Available' field - as it introduces the possibility of inconsistencies in
the database.
yes, i do not require a history. so wat do u propose i do? is there a way to
prevent a film from being checked-out twice?? if so, how do i do that?
i just wanted to make the program a bit more sophisisticated by introducing
an available field, so it is clear to the user, that the film is either on
rent, or in store.
u mentioned dlookup, that just basically looks up wat is already in the
table. u cant edit the value?
dev
"Anthony England" <ae******@oops.co.uk> wrote in message
news:dt**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com... "DP" <DP@hotmail.com> wrote in message news:yw******************@newsfe5-gui.ntli.net... hi.,
i've got 3 tables, customer, film and filmrental.
i've got a customer form, with a sub form at the bottom, which is a film rental subform.
i've created an update query, which when a filmid, is entered into the subform, the 'available' check box in the film table, becomes false (Unchecked). according to which filmID it is. heres the code, i;ve got
in an update query. "Available"=False
NOTE. it is not in VB, its just in the 'Update To' bit, in the design view.
this is all good, as it works.
how can i get it to do the opposite, when i delete a record, from the subform? e.g. when the record is deleted, the checkbox becomes (Ticked) True again?
tia
Dev
If the design of this database is as I understand, you simply add and
delete records from the filmrental table to model films being checked in and checked out. Obviously this would leave you with no history of which customers have rented which films - is that the intended design? If so, then you don't need the field 'Available' in the films table as a simple dlookup would tell you whether the film was in or out. Even with a more sophisticated design, one could debate the pros and cons of having
the 'Available' field - as it introduces the possibility of inconsistencies in the database.
"DP" <DP@hotmail.com> wrote in message
news:3G*******************@newsfe5-gui.ntli.net... yes, i do not require a history. so wat do u propose i do? is there a way to prevent a film from being checked-out twice?? if so, how do i do that?
i just wanted to make the program a bit more sophisisticated by introducing an available field, so it is clear to the user, that the film is either on rent, or in store.
u mentioned dlookup, that just basically looks up wat is already in the table. u cant edit the value?
dev "Anthony England" <ae******@oops.co.uk> wrote in message news:dt**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com... "DP" <DP@hotmail.com> wrote in message news:yw******************@newsfe5-gui.ntli.net... > hi., > > i've got 3 tables, customer, film and filmrental. > > i've got a customer form, with a sub form at the bottom, which is a > film > rental subform. > > i've created an update query, which when a filmid, is entered into the > subform, the 'available' check box in the film table, becomes false > (Unchecked). according to which filmID it is. heres the code, i;ve got in > an > update query. "Available"=False > > NOTE. it is not in VB, its just in the 'Update To' bit, in the design > view. > > this is all good, as it works. > > how can i get it to do the opposite, when i delete a record, from the > subform? e.g. when the record is deleted, the checkbox becomes (Ticked) > True > again? > > tia > > Dev
If the design of this database is as I understand, you simply add and delete records from the filmrental table to model films being checked in and checked out. Obviously this would leave you with no history of which customers have rented which films - is that the intended design? If so, then you don't need the field 'Available' in the films table as a simple dlookup would tell you whether the film was in or out. Even with a more sophisticated design, one could debate the pros and cons of having the 'Available' field - as it introduces the possibility of inconsistencies in the database.
The fact that you can't edit the value is the beauty of it - you cannot have
inconsistent data. Sure, you can place a control on the main form to show
this: a colour-coded textbox showing either "Available" or "On Loan" would
be one possibility. But the important thing is that the database decides
automatically for you whether the film is available or not by looking in the
filmrental table.
We could give further advice on how to do this, but you have not mentioned
how your database handles quantities of films. Does each entry in the film
table relate to a single copy of the film, or would you list the film as,
say, "Pulp Fiction" and say that you have 3 copies?
oh, i'm sort of understanding u.
ive got a film like pulpfiction, but it is duplicated 5 times, so each copy
has is own ID.
it relates as a single copy.
have u got any examples, or somthing i could use to learn how to do that? or
is there a way to stop a film from being rented twice?
thanx
devin
"Anthony England" <ae******@oops.co.uk> wrote in message
news:dt*********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com... "DP" <DP@hotmail.com> wrote in message news:3G*******************@newsfe5-gui.ntli.net... yes, i do not require a history. so wat do u propose i do? is there a
way to prevent a film from being checked-out twice?? if so, how do i do that?
i just wanted to make the program a bit more sophisisticated by introducing an available field, so it is clear to the user, that the film is either
on rent, or in store.
u mentioned dlookup, that just basically looks up wat is already in the table. u cant edit the value?
dev "Anthony England" <ae******@oops.co.uk> wrote in message news:dt**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com... "DP" <DP@hotmail.com> wrote in message news:yw******************@newsfe5-gui.ntli.net... > hi., > > i've got 3 tables, customer, film and filmrental. > > i've got a customer form, with a sub form at the bottom, which is a > film > rental subform. > > i've created an update query, which when a filmid, is entered into
the > subform, the 'available' check box in the film table, becomes false > (Unchecked). according to which filmID it is. heres the code, i;ve
got in > an > update query. "Available"=False > > NOTE. it is not in VB, its just in the 'Update To' bit, in the design > view. > > this is all good, as it works. > > how can i get it to do the opposite, when i delete a record, from the > subform? e.g. when the record is deleted, the checkbox becomes
(Ticked) > True > again? > > tia > > Dev
If the design of this database is as I understand, you simply add and
delete records from the filmrental table to model films being checked in and checked out. Obviously this would leave you with no history of which customers have rented which films - is that the intended design? If so, then you don't need the field 'Available' in the films table as
a simple dlookup would tell you whether the film was in or out. Even
with a more sophisticated design, one could debate the pros and cons of having the 'Available' field - as it introduces the possibility of inconsistencies in the database.
The fact that you can't edit the value is the beauty of it - you cannot
have inconsistent data. Sure, you can place a control on the main form to show this: a colour-coded textbox showing either "Available" or "On Loan" would be one possibility. But the important thing is that the database decides automatically for you whether the film is available or not by looking in
the filmrental table. We could give further advice on how to do this, but you have not mentioned how your database handles quantities of films. Does each entry in the
film table relate to a single copy of the film, or would you list the film as, say, "Pulp Fiction" and say that you have 3 copies?
"DP" <DP@hotmail.com> wrote in message
news:d3******************@newsfe5-gui.ntli.net... oh, i'm sort of understanding u.
ive got a film like pulpfiction, but it is duplicated 5 times, so each copy has is own ID. it relates as a single copy.
have u got any examples, or somthing i could use to learn how to do that? or is there a way to stop a film from being rented twice?
thanx
devin
There is good news and bad news. The good news is that with the database
design as it is it will be extremely easy to stop a film being rented
twice - if you put a unique index on the field filmrental.film then you are
saying that no film can appear twice in the table. It is impossible to make
a mistake in your coding and have the film out twice.
The bad news is that ther is, in fact, no need for the filmrental table.
You only need tables customer and film. In the film table you need to store
which customer has borrowed the film or leave it blank if no-one has the
film. This is extremely simple and guarantees that any copy of a film can
only be on loan to one customer - or to no customers if it is available.
There would only be a need for the third table if you wanted to store
history - which you have said you don't.
If the database is really this simple, then I'd guess this is not a
real-life application, more of an excercise to get to know Access - am I
right?
hi,
the film tables only hold the film names, actors, type, etc...
i do need the 3 tables, because thats wat links them altogether. if i only
had 2 tables, i would have a many-to-many relationship, which does not work.
if the 3 table idea is easy, y cant i stop it from holding duplicates?? the
filmID is unique, and its a primary key, the membershipID is unque and a
primary key, and rentledID is unique and a primary key.
however, after all that, i've got this piece of code, which stops duplicate
entries. ;
Private Sub FilmID_BeforeUpdate(Cancel As Integer)
If DCount("*", "tblFilmRental", "FilmID=" & Me![FilmID]) > 0 Then
Cancel = True
MsgBox "This value has already been used.", _
vbOKOnly + vbInformation, "Duplicate Entry"
End If
End Sub
now the problem is, the cursor is on the filmID field, and i cant move it,
untill i enter an ID (Number), how can i stop this? is there a way to just
'back-out' without having to add a filmID for the sake of it??
thanx
dev
"Anthony England" <ae******@oops.co.uk> wrote in message
news:dt**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... "DP" <DP@hotmail.com> wrote in message news:d3******************@newsfe5-gui.ntli.net... oh, i'm sort of understanding u.
ive got a film like pulpfiction, but it is duplicated 5 times, so each copy has is own ID. it relates as a single copy.
have u got any examples, or somthing i could use to learn how to do
that? or is there a way to stop a film from being rented twice?
thanx
devin
There is good news and bad news. The good news is that with the database design as it is it will be extremely easy to stop a film being rented twice - if you put a unique index on the field filmrental.film then you
are saying that no film can appear twice in the table. It is impossible to
make a mistake in your coding and have the film out twice.
The bad news is that ther is, in fact, no need for the filmrental table. You only need tables customer and film. In the film table you need to
store which customer has borrowed the film or leave it blank if no-one has the film. This is extremely simple and guarantees that any copy of a film can only be on loan to one customer - or to no customers if it is available. There would only be a need for the third table if you wanted to store history - which you have said you don't.
If the database is really this simple, then I'd guess this is not a real-life application, more of an excercise to get to know Access - am I right?
"DP" <DP@hotmail.com> wrote in message
news:91******************@newsfe5-win.ntli.net... hi,
the film tables only hold the film names, actors, type, etc... i do need the 3 tables, because thats wat links them altogether. if i only had 2 tables, i would have a many-to-many relationship, which does not work.
if the 3 table idea is easy, y cant i stop it from holding duplicates?? the filmID is unique, and its a primary key, the membershipID is unque and a primary key, and rentledID is unique and a primary key.
however, after all that, i've got this piece of code, which stops duplicate entries. ;
Private Sub FilmID_BeforeUpdate(Cancel As Integer) If DCount("*", "tblFilmRental", "FilmID=" & Me![FilmID]) > 0 Then Cancel = True MsgBox "This value has already been used.", _ vbOKOnly + vbInformation, "Duplicate Entry" End If End Sub
now the problem is, the cursor is on the filmID field, and i cant move it, untill i enter an ID (Number), how can i stop this? is there a way to just 'back-out' without having to add a filmID for the sake of it??
thanx
dev
"Anthony England" <ae******@oops.co.uk> wrote in message news:dt**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... "DP" <DP@hotmail.com> wrote in message news:d3******************@newsfe5-gui.ntli.net... > oh, i'm sort of understanding u. > > ive got a film like pulpfiction, but it is duplicated 5 times, so each > copy > has is own ID. > it relates as a single copy. > > have u got any examples, or somthing i could use to learn how to do that? > or > is there a way to stop a film from being rented twice? > > thanx > > devin
There is good news and bad news. The good news is that with the database design as it is it will be extremely easy to stop a film being rented twice - if you put a unique index on the field filmrental.film then you are saying that no film can appear twice in the table. It is impossible to make a mistake in your coding and have the film out twice.
The bad news is that ther is, in fact, no need for the filmrental table. You only need tables customer and film. In the film table you need to store which customer has borrowed the film or leave it blank if no-one has the film. This is extremely simple and guarantees that any copy of a film can only be on loan to one customer - or to no customers if it is available. There would only be a need for the third table if you wanted to store history - which you have said you don't.
If the database is really this simple, then I'd guess this is not a real-life application, more of an excercise to get to know Access - am I right?
You would be better off detecting that the film is on loan before you get to
the BeforeUpdate event. For example, imagine if you presented the user a
list of available films only then you would not start creating a record with
an unavailable film and then have to try to sort it out.
By the way, just to have another go at explaining my comments on table
design:
If each film in the film table represents a single physical copy and there
is no history being kept then each film cannot appear more than once in your
filmrental table. Do you agree? So for both tables, the FilmID is unique.
This is a one-to-one relationship between the two tables and means that you
could actually get rid of the film rental table.
I am not saying this is how I would design the database, but as you have
chosen to set it up, you have a simple one-to-many relationship between
customers and films. That is, a customer may borrow many films but any film
can only be borrowed by one customer.
yea, yor right.
i've actually come to far, to start changing my design now, i'm almost
finished.
i only got this last little problem to sort out, and then i'm done. i've
only gotta make a prototype version, and this db program wat i've made is
lookin brilliant.
how would i detect if the film is on loan before? i thought u can only
detect, when the field is entered with a number? becuase there is no number
in there otherwise, to detect?
(I cant use a combo/list box, cos even if it worked, there would be too many
films in the list!!)
thanx
dev
"Anthony England" <ae******@oops.co.uk> wrote in message
news:dt**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com... "DP" <DP@hotmail.com> wrote in message news:91******************@newsfe5-win.ntli.net... hi,
the film tables only hold the film names, actors, type, etc... i do need the 3 tables, because thats wat links them altogether. if i
only had 2 tables, i would have a many-to-many relationship, which does not work.
if the 3 table idea is easy, y cant i stop it from holding duplicates?? the filmID is unique, and its a primary key, the membershipID is unque and a primary key, and rentledID is unique and a primary key.
however, after all that, i've got this piece of code, which stops duplicate entries. ;
Private Sub FilmID_BeforeUpdate(Cancel As Integer) If DCount("*", "tblFilmRental", "FilmID=" & Me![FilmID]) > 0 Then Cancel = True MsgBox "This value has already been used.", _ vbOKOnly + vbInformation, "Duplicate Entry" End If End Sub
now the problem is, the cursor is on the filmID field, and i cant move
it, untill i enter an ID (Number), how can i stop this? is there a way to
just 'back-out' without having to add a filmID for the sake of it??
thanx
dev
"Anthony England" <ae******@oops.co.uk> wrote in message news:dt**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... "DP" <DP@hotmail.com> wrote in message news:d3******************@newsfe5-gui.ntli.net... > oh, i'm sort of understanding u. > > ive got a film like pulpfiction, but it is duplicated 5 times, so
each > copy > has is own ID. > it relates as a single copy. > > have u got any examples, or somthing i could use to learn how to do that? > or > is there a way to stop a film from being rented twice? > > thanx > > devin
There is good news and bad news. The good news is that with the
database design as it is it will be extremely easy to stop a film being rented twice - if you put a unique index on the field filmrental.film then you are saying that no film can appear twice in the table. It is impossible to make a mistake in your coding and have the film out twice.
The bad news is that ther is, in fact, no need for the filmrental
table. You only need tables customer and film. In the film table you need to store which customer has borrowed the film or leave it blank if no-one has
the film. This is extremely simple and guarantees that any copy of a film can only be on loan to one customer - or to no customers if it is
available. There would only be a need for the third table if you wanted to store history - which you have said you don't.
If the database is really this simple, then I'd guess this is not a real-life application, more of an excercise to get to know Access - am
I right? You would be better off detecting that the film is on loan before you get
to the BeforeUpdate event. For example, imagine if you presented the user a list of available films only then you would not start creating a record
with an unavailable film and then have to try to sort it out.
By the way, just to have another go at explaining my comments on table design: If each film in the film table represents a single physical copy and there is no history being kept then each film cannot appear more than once in
your filmrental table. Do you agree? So for both tables, the FilmID is
unique. This is a one-to-one relationship between the two tables and means that
you could actually get rid of the film rental table.
I am not saying this is how I would design the database, but as you have chosen to set it up, you have a simple one-to-many relationship between customers and films. That is, a customer may borrow many films but any
film can only be borrowed by one customer.
"DP" <DP@hotmail.com> wrote in message
news:NQ*******************@newsfe7-win.ntli.net... yea, yor right.
i've actually come to far, to start changing my design now, i'm almost finished.
i only got this last little problem to sort out, and then i'm done. i've only gotta make a prototype version, and this db program wat i've made is lookin brilliant.
how would i detect if the film is on loan before? i thought u can only detect, when the field is entered with a number? becuase there is no number in there otherwise, to detect?
(I cant use a combo/list box, cos even if it worked, there would be too many films in the list!!)
thanx
dev
The user is going to type in a number? Well, the absolute simplest way
would be to have a button which pops up an inputbox asking for the number.
You can then use your dlookup idea to see if the film is in the rental
table, if so let the user know it is on loan. If not, you can take that
number and use it to fill out a new record in the filmrental table. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bill Clark |
last post by:
I have about 20,000 records pulled from Excel that I need to update.
What I need to do is run an update query that bascially says: If a
field is null, update it with the previous record value of...
|
by: Don Seckler |
last post by:
I have an update query that runs when a report closes. I have several
reports that will need to run the update query with diferent criteria.
I'd like to simply make the criteria change in the...
|
by: James Butler |
last post by:
Our setup:
Online db: MySQL
Inhouse db: MS Access 97 with MySQL tables linked via ODBC
Our issue:
Almost every field updates successfully, except one.
A scenario:
Information is written to...
|
by: Andrew |
last post by:
I've got a list box that selects a record on a subform, and in that
subform are a few text fiels and a button that runs an update query.
How do I have the update query button run and only update...
|
by: deko |
last post by:
I'm trying to update the address record of an existing record in my mdb with
values from another existing record in the same table. In pseudo code it
might look like this:
UPDATE tblAddress SET...
| |
by: Mark Carlyle via AccessMonster.com |
last post by:
I have this update query that I am trying to run. I know the syntax is
messed up but do not know how to correct it.
Select 'UPDATE', Transactions,'Set = where =
' From "Get Daily Balances"
...
|
by: Lag |
last post by:
Having a problem updating my database from a web page, through a
submission form. Can anyone help?
----THIS IS MY CODE IN update.php----(user, pass, and database are
typed in directly, I...
|
by: colleen1980 |
last post by:
Hi: In my table there is a field of type checkbox. I create a button on
my form and wants to deselect all the checkboxes in that field
(PrintQueue).
Table: Research_New
PrintQueue Format Yes/No...
|
by: DuncanIdaho |
last post by:
Hi
Apologies if this is similar to a (very) recent post.
I was wondering if it is possible to execute an update query that
contains a select statement on an MS access 2000 database.
I have...
|
by: giovannino |
last post by:
Dear all,
I did a query which update a sequence number (column NR_SEQUENZA) in a table using a nice code (from Trevor !).
1) Given that I'm not a programmer I can't understand why...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |