Updating Specific Fields In Table
Dec 9, 2005
Hello everybody. I am new to Access and as such I don’t know how to perform the following. Please help me out.
The project is about a library loan system. I have a database consisting of the following tables: member (MemCode, LName, …), book (BkCode, Title, TotalCopies,…), purchase (PurDate, BkCode, CopiesBought,…) and transaction (MemCode, BkCode, RentalDate,ReturnDate,Returned).
TotalCopies is the total no. of copies there are of the book
CopiesBought is the number of copies that have been purchased
RentalDate is the date on which book is being loaned
ReturnDate is the last date on which the book has to be returned
Returned is a Yes/No field to indicate if the book has been returned
In the library a member can take only one book at a time.
Problem 1:
The library may have several copies of a particular book, but all will have the same code. For example, a book, let’s say Harry Potter 6 has code 97. Initially only 1 copy of the book is purchased. When the librarian sees the book has great demand, he decides to purchase 3 more copies. All the copies will have the same code, i.e., 97. Only the TotalCopies will become 4.
BkCode is Autonumber in book table and Number in Purchase table. Relationship is 1:many.
I have a Purchase form to record details of books being purchased. I have a command button “Book form” that opens the book form when the user clicks on it. He will use it if the book being purchased is not already available in the library. What I want is:
(i)If he opens the book form to fill in details of the book, then when he closes the form I want the book details to automatically appear in the corresponding fields on the Purchase form.
(ii)The CopiesBought will have to be used to update the TotalCopies in the book table. How should I do this?
Problem 2:
When the user wants to record a loan, the system will need to check if that member already has a book which he has not yet returned. If it is so, then the system will need to provide a prompt to inform the user of this and consequently blocks the user from completing the transaction. How do I do this?
Thanking you in advance for your help.
View Replies
ADVERTISEMENT
Jul 6, 2012
I have 2 tables.
Table 1: Master table
Table 2: Temporary table
This is my current process:
Every quarter I run a report that pulls loans that meet specific criteria.I export this report into excel (the loans fall into column A)I add a file number and box number in columns B and C.I import the excel spreadsheet to table 2 (they're linked so I don't need to import, it's automatic)
Now that I have the updated information back into the database (table 2), how can I get this information back into table 1? The excel spreadsheet only contains a few loans that need to be updated in table 1. I have tried creating an update query with both tables linked and use the "update to" field. However, when I tried to run the query, it says I have 0 records updated.
My update query is as follows:
Field: Access Bar Code
Table: Table 1
Update To: [Table 2].[Access Bar Code]
Field: Access Box Number
Table: Table 1
Update To: [Table 2].[Access Box Number]
Basically I'm trying to have the query update specific fields in table 1 based on the information from table 2.
View 1 Replies
View Related
Feb 27, 2015
I am working on form where the user selects either "IN" or "OUT" from a dropdown of field name "CheckOut" in Frm1.
If they select "OUT" they will in turn need to fill in 2 additional fields. When they change the value back from "OUT" to "IN",
I want those other fields to be cleared of data for just this record so next time they change back to "OUT" from "IN" those 2 additional fields are already blank.
View 1 Replies
View Related
Dec 16, 2014
I have a form that has combo boxes and text fields (as well as sub forms). There is also a button linked to some code that says'
Private Sub cmdQuote_Click()
'Creates quote date and prints quote
Me.QuoteDate = Now()
Me.cbAgentID.Requery
DoCmd.OpenReport "Quote", acViewPreview, , "BookingID = " & Me.BookingID
End Sub
When the button is pressed the QuoteDate field (it is bound) should be be populated, but unfortunately it is not. I have played with refresh and requery but cannot derive a solution.
View 1 Replies
View Related
Sep 15, 2014
I Have a table that contains the fields: CAT, CHAPTER, ID, someSrting and Completed
CAT, CHAPTER, ID are numbers and Completed is true/false. If I mark a certain entry as Complted (true), I want all the records with the same (CAT, CHAPTER, ID) as the one I marked to be updated to Completed.
For example, If I marked the entry cat:1 chapter:1 id:1 as completed (true), I want all the entrys that have cat:1 chapter:1 id:1 to be marked as completed (true)
the code I wrote is:
Code:
Private Pub Completed_check_AfterUpdate()
Dim myCC
Dim myCat
Dim myChap
Dim myID
myCC = Me.Completed_check
myCat = Me.CAT
myChap = Me.CHAPTER
myID = Me.ID
CurrentDb.Execute "Update [my Table] " _
& "SET Completed = (" & myCC & ") " _
& "WHERE CAT = (" & myCat & ") And CHAPTER = (" & myChap & ") And ID = (" & myID & ") ;"
End Sub
I'm running the code (my clicking the "check box") and nothing happens, I was thinking that maybe I defined the after "WHERE" statement wrong, and there are 0 entrys changed..
UPDATE: after removing the
Code:
"& "WHERE..."
row, the code does update the entire table, so I have a problem with the syntax of the sql..
View 1 Replies
View Related
Jul 9, 2015
I am new to access i have a problem which is i have made a form which contains a subform and a read only subreport, what i want is the ability to select a record in read only subreport as in the picture attached and make a button that when i press on it, it should copy the values of the itemsID field, Packing field, ContainerNo field and origin field from the selected record and then paste them in the subform below.
Also i want to add more then one item, so the when i press on another record it should paste the values below the first record.
View 12 Replies
View Related
Nov 8, 2004
I have two tables, one is a list of customer details including email addresses and the other a list of customers and email addresses that have unsubscribed from my mailing list.
How can I use the unsubcribe table to update a field in the details table so I know who's unsubscribed?
View 11 Replies
View Related
Jun 17, 2007
Hello
I have a table with 3 fields:
- ID no (primany key), Time1 and Time2
I have 3 records with ID no 1 to 3.
So my table look like this
ID no: Time1: Time2:
1 [emty] [emty]
2 [emty] [emty]
3 [emty] [emty]
I have an Excel document with the data for field Time1 and another Excel dokument with the data for field Time2. Excel doc1 have 2 colums named ID no and Time1. And Excel doc2 have 2 colums named ID no and Time2.
How do I import/update these data into my table?
I have tried wiht a adding-quiry but it only works if the table is complety emty and only with one Excel doc. Trying the second Excel doc afterwards only makes an error and no fields are updated.:confused:
View 4 Replies
View Related
Nov 17, 2004
Hi all~
Does anybody know how to go about running a query or macro in Access to import specific fields from all worksheets contained in an excel workbook?
Say I have ExcelFile.xls, and it has worksheets with varying names. I want to pull fields B12, B16, B20, B24, B28 from each worksheet and create a new record in a table (one new record for each worksheet). Is there an easy way to do this other than pulling the data into a Crystal Reports pivot table or some such?
View 2 Replies
View Related
Nov 14, 2007
Hi everyone,
I was wondering if this is possible to do:
I have a Form that reads from one Linked Table and Updates a Local Table. Is it possible to move the Local Table to the Back End and still be able to append fields and change field names etc?
If anyone can help, that would be greatly appreciated. Thank you in advance.
Bear
View 1 Replies
View Related
Sep 20, 2006
I've been working on this problme for several weeks, thinking about it for the last month or so, and am at a loss of what to try next. I'm working on a database for my office that tracks all of the permits we have issued. Every year our permit fees increase by the CPI (consumer price index) and the permit fee entry in the table needs to be updated (75 to 80 entries).
Rather than typing them in every year (too many chances for errors) I'd like to be able to update our fee schedule table (8 entries, look up table) and have that table update all of our fee entries in the permit table.
Any ideas of how to go about this? Thank you for your help.
Scott
View 1 Replies
View Related
Nov 26, 2005
I have a data entry form where country(ies) (there can be more than one for
each project) is/are entered in a sub-form on a tab control. Countries not
listed are entered by the following:
Private Sub CountryName_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim strMsg As String
Dim ctl As Control
Set ctl = Screen.ActiveControl
strMsg = "Country " & NewData & " Is not listed!" & vbCrLf & "Do you want to
add it?"
If MsgBox(strMsg, vbYesNo, "Not listed") = vbYes Then
strSQL = "INSERT INTO tblCOUNTRY (CountryName) "
strSQL = strSQL & "VALUES('" & NewData & "');"
CurrentDb.Execute strSQL
Response = acDataErrAdded
Else
ctl.Undo
Response = acDataErrContinue
End If
End Sub
This works fine. However, if I restrict the country names by a region
selection on the main form (for example if region Africa is selected on the
the African countries are preselected) the NotIn List does not work. Any way to work around this?
Another question, I want the user to select a region (a combo box ) on the
main form and when a new country (using the NotInList event) is entered in the subform both values go into
the same record in tblCountry (which has two fields CountryName and Region).
For example, I enter AFRICA for region on the main form and on the sub-form I enter Malawi which is not listed. I have tried the following:
Private Sub CountryName_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim strMsg As String
Dim ctl As Control
Set ctl = Screen.ActiveControl
strMsg = "Country " & NewData & " Is not listed!" & vbCrLf & "Do you want to
add it?"
If MsgBox(strMsg, vbYesNo, "Not listed") = vbYes Then
strSQL = "INSERT INTO tblCOUNTRY (CountryName, Region) "
strSQL = strSQL & "VALUES('" & NewData & "', FORMS!frmAddPro!Region);"
CurrentDb.Execute strSQL
Response = acDataErrAdded
Else
ctl.Undo
Response = acDataErrContinue
End If
End Sub
But it does not work (Region is the control on the main form named frmAddPro).
Any suggestions would be welcome. Thanks.
Niels
View 4 Replies
View Related
Dec 6, 2005
Hello,
Been wondering how I can update fields in my Access database table using data that lies in an excel spreadsheet.
They have a common row ie say account number and other common fields that need to be updated.
thanks
View 1 Replies
View Related
Apr 25, 2012
I decide to add a new field to its related table. I always wait to create the form until I think my table is complete, but sometimes I just end up needing to add more info. Is there a quick way to update the form to include my new fields?
View 7 Replies
View Related
Apr 26, 2014
how can i make a specific field to be a sum of many other Fields in design table with out using codes
View 1 Replies
View Related
Sep 23, 2013
I need to create a form that automatically populates Dealer_ID in my Customers table when a user selects Dealership from a dropdown box.
The form is updating all of the user controlled fields in the Customer table as the user inputs the information. I have a separate Dealership table who's Primary Key is Dealer_ID where dealership information (including the dealer name) is stored. A one to many relationship is in place that connects Dealer_ID from the Dealership table to the same field in the Customer table. The user inputting the information will know what the dealership name is but will not know their ID. I need a solution that will allow the user to select a dealership name in the form and auto-populate the Dealer_ID field in the Customer table with the appropriate ID from the Dealership table.
View 1 Replies
View Related
Mar 8, 2013
I have a Form named 'Opening_Screen' which consists of various objects - Combo Boxes, RadioButtons, Check Boxes which the user can select.There is a subform called 'Report' within the 'Opening_Screen'. The source object of the subform is a query (called 'QueryX').
There is a button called 'Generate Report' on the form which when clicked - an SQL must run on the backend, update the query which in turn should update the Subform 'Report'.For me, the QueryX gets updated, but the subform doesn't. When I manually switch the form to Design View and then back to Form View - the subform gets updated. I tried the same through the vba code instead, but it doesn't update the subform.
View 10 Replies
View Related
Nov 6, 2013
So I currently have a table that tracks medication activity for patients called tblMedRanges. The Fields are the ID, StartMedication, EndMedication, Med ID/Medication Name.
In the End of Medication, some patients are not currently active so they have a set date/time field property. What I have for right now is the default value is set to
Code:
=date()
So that when staff adds a new medication it is set to the current date. These patients are supposed to be active, but it doesn't update the default value. I want it to continue to update to the current date every time the database is open.
I have three options that I know of(or think I know of) to update but can't commit to one in particular :
1)I want these individual records in the field to update the current time for today and was considering using some kind of data macro code using before update.
2)The other idea I had was splitting up the field into an EndOfMedication field that would display a value only if their inactive, and an Active field (text, value list active/inactive choices) that would be used in a query to generate the current date as med field. This would take some crafty query work with comparisons later on to generate list of drugs that they were on for each visit.
3) set to text field and convert the field to date field for comparison in queries.
View 2 Replies
View Related
Jun 20, 2006
Hey Everyone,
I am stuck trying to figure out this problem. I have a main form "frm_tirelog_600" which has 4 combo boxes "cboleg",
"cbocar", "cbopos", "cboserial" on it. The first 3 combo boxes are used as criteria on 1 of 3 subforms that I have.
The fourth combo box "cboserial" is used for the criteria in a query on another subform that I have called "frm_mount_600_subform",
which is independant from the main form, I hope I have explained that clearly enough. What I need to be able to do is
have the subform fill in 3 of the fields on it "leg", "car", "pos" with the value from the 3 combo boxes on my main form. I
can get it to show in the fields but not write to the table. I have searched the forum and have not been able to locate anything
that would work and really need any assistance with this. Im not real strong in the coding department which is where I
beleive this could be done.
I have attached a copy of my DB which I hope will better explain it. Any help would be greatly appreciated
View 8 Replies
View Related
Aug 28, 2006
Hey,
The database I am working on, I split a while ago to give it some security. Now i'm updating a related form, and i'm finding that if I delete and add fields in the BE, the FE fields (being the fields that I need to insert into the form so the data entered propogates to the DB) are not updated.
How do I update the FE?
Thanks.
View 1 Replies
View Related
Dec 13, 2006
I have an SQl statement which brings out the correct resutls however does not update the fields requested, Can any see what is worng with the followng code.
When testing the code the results are exactly wat i want, but they dnt seem to be updating the fields. Theere is a command button on the form, a list of orders appear on a listbox on the form which i have locked.
If StrPtr(stringy1) <> 0 Then
Me.Person.SetFocus
Sql = "Update [tbl_Delupdate] SET "
Sql = Sql & "[Date of D Status] = '" & Stringy2 & "', "
Sql = Sql & "[D Status] = 'Delivered' "
Sql = Sql & "WHERE [Time of Transaction] = #" & datMaxDate & "# "
Sql = Sql & "AND [Cylinder Barcode Label] = '" & stringy1 & "' "
Sql = Sql & "AND [Works Order Number] = '" & Me.Person.Text & "' "
MsgBox Sql
Debug.Print Sql
db.Execute (Sql)
View 1 Replies
View Related
Feb 9, 2005
I've created an ubounded form and all of my fields are not populating. 7 out of 13 fields show data but not all of the data. When I look at the table all information is documented but able to view on form. I've gone over other DB's for review and can't seem to figure out why it's not populating. Also I can't delete any of the records.
I've attached the db for some1 to help me...
View 4 Replies
View Related
Feb 2, 2008
Here's my problem:
I have a table called WorkOrder. I have fields labeled:
JobID, which is an autonumber
WODate, which is formatted as =Date()
and WOID, long integer
Here's what I want to do and have done:
On my form I have WOID control source set to:
=Format([WODate],"mmddyy") & Format([JobID],"00")
I know that storing calculated values isn't the preferred method but it's what I've done.
The problem is I have a cmd button on the form, that when clicked asked for the WOID. This button is based on a query to print a specific work order.
The problems is that this calculated value (WOID) isn't appended to the table so nothing exists when the cmd button is click and the WOID is entered.
How can I update the table with this WOID for the specific job?
View 1 Replies
View Related
Jan 30, 2007
Hey guys,
Is there a setting that will allow me to make specific fields in my table read-only unless I enter a password, or I am the DB administrator?
View 5 Replies
View Related
Jan 10, 2007
I have two table Client_details and Release_details in a database,were client field is the primary keyin both the tabels.I want to update records of Airtel-India in Release_details,for that i have wrriten a query
UPDATE Client_detail, Release_detail SET Client_detail.Client = "Airtel-India", Release_detail.Client = "Airtel-India"
WHERE (((Client_detail.Client)="Bharati Chennai") AND ((Release_detail.Client)="Bharati Chennai"));
but after running an error message is shown like
Microsoft access didnt update 0 fileds due to a type conversion failure,16 records due to key violations,0 records due to validation rule violations
:confused:
View 1 Replies
View Related
Dec 30, 2004
Hey ya'll,
I'm trying to figure out how to subtract a value entered on a form from one table, from a column in a different table. I was trying to us an AfterUpdate on a texbox to run some VB that would run a SELECT statement to get the current value (InStock), subtract the value in the textbox, and run an UPDATE statement to update InStock. But all I got were a lot of errors saying that I was using mismatched objects and nothing was getting update. Please help.
Thanks,
Chris
View 4 Replies
View Related