473,467 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to change a value on another form/table using a button on a form

27 New Member
The database is designed to record all Dvd's in my collection and monitor them when friends take them, kind of like a rental system.

The tables/forms in question are DVD's (a table storing all information about the Dvd's) and rentals (the basic rental details, who, when etc) and rental details (the list of films)

The DVD table/form has an availability check box (yes/no) to state whether the dvd is avialable or not.

The Rentals form has Rental details as a subform and I would like to have a button on the main form that when clicked, changes the availability check box on the DVD table or form for the DVD's listed in the rental details subform.

I want to say it can be done using an If statement but I don't know how to go about it. I have tried adding this object onto the subform with the control source set to the DVD table. I then wrote VBA on the lostfocus event of another field to try and update this field but I got an error saying I can't write to this field.

Any ideas? I would be more than grateful if anyone can help. It's driving me crazy

Thanks

Groovygirl
May 19 '10
61 6986
groovygirl3003
27 New Member
Blonde me here didn't even think of putting it in a query alone, I was just putting it straight into the combo box.

I had the same syntax error and I managed to solve it last night. I can't remember how I did it now though and I haven't got my database with me at the mo (must have just been luck)

I'll have a look tonight, I am sure I am getting the correct results but it just keeps removing the previously stored data :-(
May 25 '10 #51
patjones
931 Recognized Expert Contributor
@groovygirl3003
You can either put it straight into the combo box, or put it in a query and then base the combo box upon the query.
May 25 '10 #52
groovygirl3003
27 New Member
In fact, I have just noticed my whole database appears to be messed up :-(

When I am looking at the tables, I inserted Rentals as a subdatasheet in DVDs and the data is wrong somehow.

The subdata sheet shows all rentals and not just the ones that relate to that DVD_ID.

What have I done?
May 25 '10 #53
groovygirl3003
27 New Member
@groovygirl3003
Sorry please ignore that last post, another blonde moment.
May 26 '10 #54
NeoPa
32,556 Recognized Expert Moderator MVP
So where are we after all that then GroovyGirl? All done? Any outstanding issues? Will I regret even asking? :D
May 26 '10 #55
groovygirl3003
27 New Member
@NeoPa
Don't ask. It's still in the same position. I have given it to my tutor to look at. I have had my boss look at it and now I have sent it down for my brother to look at it.

I have made another query and sub query with the help of the boss that gets the right info but can't get it to work in the combo box.

The code for the query is:

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT DVD_ID
  2. FROM DVDs
  3. WHERE DVD_ID NOT IN 
  4. (SELECT DISTINCT DVD_ID FROM [Unavailable DVD's]);
  5.  
May 26 '10 #56
patjones
931 Recognized Expert Contributor
@groovygirl3003
I don't understand. That doesn't match up with either of the queries that we presented, both of which worked great when I inserted them in the rowsource entry of your combo box.
May 26 '10 #57
groovygirl3003
27 New Member
@zepphead80
The code that you wrote worked fine on the subform itself but as soon as I used it as part of the main form/subform and chose a value, it deleted all other instances where this dvd id appeared in the table and left the fields blank.

I'm still trying to find a solution to that bit so I can use that piece of code instead.
May 26 '10 #58
patjones
931 Recognized Expert Contributor
@groovygirl3003
Which one is the main form in the file that you posted? I will give it a try...
May 26 '10 #59
groovygirl3003
27 New Member
@zepphead80
It's the rentals form.
May 26 '10 #60
patjones
931 Recognized Expert Contributor
I have the main form open and I am able to make selections from the combo box just fine. I'm not really sure what it is that you are looking to have happen after a selection is made from the combo box.

It seems to me that we solved your initial problem, which was to get the box populated with only the available DVDs, and that now you have some other issue which may not be related to this. Am I right?

Pat
May 26 '10 #61
groovygirl3003
27 New Member
@zepphead80
Yes that is corret. I can select a DVD from the list and these are the correct ones showing yet when I look back over previous rentals the values have been removed.
May 27 '10 #62

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: duy944t | last post by:
Hi, I have a two tables, Breeding and Mouse. The Breeding table contains information of the parent mice. The Mouse table contains information of the pups. Each table contains a field called...
17
by: Rico | last post by:
Hello, I am in the midst of converting an Access back end to SQL Server Express. The front end program (converted to Access 2003) uses DAO throughout. In Access, when I use recordset.AddNew I...
4
by: joeywjones | last post by:
Although I've created and used Excel for about 8 years, I've got loads to learn., and I'm not even certain how to word my question, but here goes. I've recently created a database into which I can...
2
by: rpjd | last post by:
I am trying to submit entries in a form to a database. I am using " within my submission form and $_POST I am getting the connection to the database but I my script is not executing,...
3
by: Manikandan | last post by:
Hi, I have table with three columns as below table name:exp No(int) name(char) refno(int) I have data as below No name refno 1 a 2 b 3 c
3
by: Ciara9 | last post by:
I am using Access 2003 and have 2 tables. One has customer information in it (such as name,dates,amount, etc...) and the 2nd table is more of a Comments table (displays username, time and date, and...
1
by: kanav21 | last post by:
Hi Everybody, I am hoping somebody will be able to help me with this.. I have a simple table called Product - This table has 5 fields: 1. Design_Code (this is the primary key) 2. Original_Qty...
2
by: rameshgohil | last post by:
I am using grid view and a button column in it using <itemTemplate> but I am not able to rerive cell value of a selected row from grid view. I have tried the following to methods in Row_command...
1
by: veer | last post by:
hi i am trying to access the mdb table value into strings but it transfer only one column value and on next colum it show error "item not found inthis collection" dbRec.MoveLast() ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.