Update Difficulties!!!!!
Jun 29, 2006
Hey guys,
This has really got in my nerves.....
I have a table with 2 fields (pr_row, pr_col).
All i want to do is:
I want to update the table so that every 21 records, the pr_col field will increase from 1 to 21 and so on, and the pr_row field
will remain with the same value (but increasing by 1 every 21 records)
Explaining
pr_row-pr_col
===========
1 - 1
1 - 2
1 - 3
.
.
.
.
1 - 21
2 - 1
2 - 2
2 - 3
.
.
.
What is the update query that i must execute?
View Replies
ADVERTISEMENT
Feb 22, 2006
I've been working on a database for the last month or so. It's been a slow process since I've been learning Access and VBA in the process.
But my supervisor wanted a copy of it as a progress check to send to his boss. So I sent an email with a copy of the database as an attachment.
THe email went through, but when my supervisor tried to open said email, a dialogue came up saying that Access couldn't open the file because it was "out of the intranet or on an insecure site" or something along those lines
I was just wondering what this meant and how I would be able to send my boss a copy of the database so that it can be reviewed and such. Would this require splitting it?
Thanks in advance,
Nathan
View 2 Replies
View Related
Aug 29, 2007
I'm having trouble creating my query
I have a table representing the company's products. Ever once in a while the products get replaced by a newer product. Like below
_____________________________
Product - Replaces - Replaced By
a..................................b
--------|----------|-----------
b.................a...............e
--------|----------|------------
c
--------|----------|------------
d
------------------------------
e.................b
Can someone help me write a query so the result below will be shown in
three fields.
Product - Replaced by level 1 - Replaced by Level 2-Replaced by level 3
....a..................b.......................... . e......................and so on
View 4 Replies
View Related
Feb 8, 2006
Hi, I’ve been having some problems being able to do some things on my database, I was doing ok creating my system but now I’m a bit confused about what to do and I’ve been trying but getting no where. Firstly on my order form I need a total for the products which are in an subform and after the order is complete I need to be able to create an invoice and keep all the order information in the 'invoice' and 'invoice details' tables. I also need it to update the stock levels after the order is complete. Then I had created a tab in 'view customers' and I wanted to have it so that past customer orders could be viewed. Any help is appreciated; here is a link to my system:
'Gamez System' (http://www.savefile.com/files/5877934)
Thanks, Bob.
View 1 Replies
View Related
Dec 14, 2006
Hi! I have a problem with my form [EDITAR], the problem is that i did a form basing me on a table, but now i want to create a command that when i press it, it has to let me edit my data. i don't know how to explain me very well. i want to change my data but changing it with my form and save that information.
the other problem is that i want to create the same form for but only to add new data on the same table, i want to create a command that i will press if i want to add new records.... help i really need help:confused:
View 7 Replies
View Related
Oct 27, 2005
Hello,
I am having difficulties with working out how to create a correct query from my database. :confused:
These are the two results I require:
What strength of whisky sells the best at Christmas (How do I do an 'In-Between' date condition regardless of the year? i.e. >= #01/12/____# AND <= #31/12____#)
Which companies have not purchased at least one bottle from each region?
However, I am not sure how I would go about getting these specific results from the database. I have done serveral previous questions based on the database (which can be seen in the .mdb file) however these two are proving troublesome. I have attached the database to this post if anyone who is at ease with queries would be kind enough to have a quick peeky at it.
Any help would be greatly appreciated !
Note. the database information is fictisious. :rolleyes:
View 1 Replies
View Related
Oct 26, 2005
Hey,
I have an access database that imports a certain range of a certain sheet from 30 files all of which are in the same folder and I am trying to get that BOTTOM MOST peice of code to automate the process.
Now one of my many complications was that the excel files are workbook protected, and so it would give the 'cannot decrypt error' that’s why I have all that code regarding unprotecting it... but for some reason its not working
It gets to the line where it gives it the password and it tells me the password is unaccepted, and yes the password is correct...
It must have something to do with the do loop, because it works fine whenever I used it over one import file and thus without the loop... Like this for ex works perfectly fine
Code:Public Function TransferSP()ExcelFile = "G:CBTFILENAME"On Error GoTo ErrTrpStartAgain: DoCmd.TransferSpreadsheet acImport, 8, "TEST", "G:CBTFILENAME", True, "Access_Upload!C13:L34"xlapp.ActiveWorkbook.Protect (blah)ErrTrp:If Err.Number = 3161 Then 'Encripterror so unprot wb xlapp.Visible = False 'Open Excel xlapp.EnableEvents = False 'Disable Events xlapp.workbooks.Open ExcelFile 'Open File xlapp.ActiveWorkbook.Unprotect (blah) 'Unprotect xlapp.ActiveWorkbook.Save 'Save xlapp.EnableEvents = True 'Enable Events xlapp.ActiveWorkbook.Close 'Close File xlapp.Quit 'Quit Excel GoTo StartAgain 'Try and Import againElseEnd IfEnd Function
So Please tell me what is wrong with this bottom piece of code...
And secondly, I have a table which contains a list of names, whether they are active (checkbox) and their filenames each on a column of its own...
Can anyone show me how i can include into my code (assuming the password problem is fixed) that would allow me to place an if statement that checks whether the user is active or not... IF he is then it imports his file (using the filename column next to his name).... If he is not active then it just goes onto the next person without importing him/her
Right now I have it importing all the files in that folder
Code:Option Compare DatabasePublic xlapp As New Excel.ApplicationPublic Sub ImportAll() Dim strPath As String Dim strFileName As String strPath = "G:CBT" 'Set Path strFileName = Dir(strPath & "*.xls") 'Set first file Do On Error GoTo ErrTrp DoCmd.TransferSpreadsheet acImport, 8, "Test 2", strPath & strFileName, True, "Access_Upload!C13:L34" ErrTrp: If Err.Number = 3161 Then 'Encription error so unprotect workbook xlapp.Visible = False 'Open Excel xlapp.EnableEvents = False 'Disable Events (Macro's) xlapp.workbooks.Open strPath & strFileName 'Open File xlapp.ActiveWorkbook.Unprotect (blah) 'Unprotect 'Try and Import again DoCmd.TransferSpreadsheet acImport, 8, "Test 2", strPath & strFileName, True, "Access_Upload!C13:L34" xlapp.ActiveWorkbook.Save 'Save xlapp.EnableEvents = True 'Enable Events xlapp.ActiveWorkbook.Close 'Close File xlapp.Quit 'Quit Excel Else End If strFileName = Dir() 'look for next file If strFileName = "" Then 'no more files Exit Do End If LoopEnd Sub
Please let me know what I can do with this
I am a novice at coding...Just tell me where to put the code
Thanks
Ayyad
View 11 Replies
View Related
Aug 29, 2007
hello all,
i stumbled upon this site via google while i was trying to find a solution to my problems! i'm a pretty proficient pl/sql writer and this is my first time trying to learn jet sql so a lot of the things i'm used to in pl/sql can't be done in jet sql!
1) i'm trying to create a summary record from RR_FT_COMPONENT to RR_FT_TOT_PAYOUT. this is basically summing some payout fields by grouping by payee_id and period_id. from my research i've seen that jet sql doesn't like sum or group by's for updates. is it the same for doing select statements for insert into?
when i run the query i get the following error: "ms access can't append all the records in the append query. MS access set 0 fields to null due to a type conversion failure"
all of the fields on both tables have the same type. is this a group by and sum problem? i ran the select statement separately and it worked fine.
code:
INSERT INTO RR_FT_TOT_PAYOUT ( market, region, financial_center, payee_id, employee_name, manager_flg, lic_code, job_code, period_id, volume, cp_spread, ytd_spread, cp_comm, ytd_comm, prior_yr_flag )
SELECT max(rc.market), max(rc.region), max(rc.financial_center), rc.payee_id, max(rc.employee_name), max(rc.manager_flg), max(rc.lic_code), max(rc.job_code), rc.period_id, sum(rc.volume), sum(rc.cp_spread), sum(rc.ytd_spread), sum(cp_comm), sum(ytd_comm), max(prior_yr_flag)
FROM RR_FT_COMPONENT AS RC
GROUP BY rc.payee_id, rc.period_id;
2) in this next code i'm trying to sum spread information in the ft_txn_summary table for a given payee_id, market and period_id. i'm using dsum and have the appropriate joins to keys on the tables, yet this update sums ALL records in the ft_txn_summary table rather than summing the specific payees in the join. any idea on what's wrong or how to debug dsums?
code:
UPDATE rr_ft_component AS rc SET rc.cp_spread = Dsum("txn_spread","ft_txn_summary","ft_txn_summary.payee_id= " & [rc.payee_id] AND "ft_txn_summary.market= " & [rc.market] AND "ft_txn_summary.period_id= " & [rc.period_id])
WHERE rc.component_name='Total Revenue';
any help would be appreciated! thank you!
View 1 Replies
View Related
Nov 14, 2004
Hi,
I am a newbie at Access and am basically designing my first database. This database is for a short term project and is designed to track the attendance of employees at acompany. Here is a brief description of the tables and forms in question.
EmployeeInformation - this table stores records of each employee, their ID, DOB and SIN.
AttendanceProfile- this table stores records of prolonged absence periods for each employee. A given employee can have many attendance profiles, meaning that this table is linked to the EmployeeInformation table via a one-many relationship. This table will provide detailed information about the status and history of each Profile. So for example if an employee misses work for 12 days due to an appendicitis operation, the exact nature and dates of this absence would be listed as a new profile. The primary key for this table is an autonumber field called ProfileID
ActionLog - this table stores the actions taken by company employees (if any) in response to each AttendanceProfile. It is connected to the profiles table via a one-one relationship with ProfileID being the foreign key in this table. Another main field is the ProcedureNum field which will list the number of each procedure taken for a given ActionLog record. This table is needed to track what the company has done/is doing to track an employees prolonged absence.
Allow me to illustrate with an example. An employee, John Doe misses 15 days in June 2001 due to an illness in the family. An AttendanceProfile record is then made for this period illustrating the exact nature of Mr. Doe's absence as well as tracking what official documents he has submitted (eg medical note, official company documents). Another matching record containing the same ProfileID is also made in the ActionLog table describing what the company has done so far to track this absence. So if an HR employee calls Mr Doe's physician to verify this illness or sends a letter requiring further documentation, each of these steps is listed in this log for this absence profile.
Sorry for the long-winded explanation, but better now than to have to clarify myself later. Here is where I'm stuck. I would like to set up two data entry forms, to create new AttendanceProfile records and related ActionLog records. Obviously, these corresponding records are linked directly by the ProfileID field. After completing the AttendanceProfile form, I would like the user to be able to click a command button to open another form (I am avoiding a subform in this case because my attendanceProfile form is huge and I cannot conveniantly fit a subform on it) to open a new form where they can enter Procedure descriptions and dates on the ACtion log. For each new procedure the user enters, an autonumber fields automatically increments the procedureNumber for that specific ProfileID.
Finally, my question to any of you is, assuming that I have already designed the AttendanceProfile table and form, how shall I design the ActionLog table AND forms to accomplish this exact task.
Once again, sorry for the excessive detail. Your assistance is greatlys appreciated.
Regards,
Mike J.
View 1 Replies
View Related
Apr 13, 2013
My membership database has worked fine until recently. Now I cannot save inserted data. On attempted saving "Update or CancelUpdate without AddNew or Edit" appears.
The problem. relates to 2 tables Member and Addresses. PK in the parent table Member is ID. In the Addresses Table the FK is ID. There is a One to One relation between the tables and Referential Integrity is set. I know 1 to 1 is not good but it worked fine in this small database.
Browsing the all of the existing records is fine.
View 9 Replies
View Related
Jun 28, 2005
Hi Guys,
I have got a query that updates details from one table2 to table1, "Reference" is the primary key and this is what the query uses to determine which need updating.
It all works great but if table2 contains a record in "Reference" that is not in table1 i just want it to ignore it, currently it just seeems to add them.
Any suggestion guys & gals?
Many thanks
Tim
View 9 Replies
View Related
Nov 29, 2006
Ok, i have a question about update queries.I have two tables (I'll call table 1 and table two for simplicity) and an update query. I want to get some data from table one to table two (via an update query). But in table two there is a field that isn't in table one but i want to add a value to that field via the query.My question is, can i manually put into the query what data to add to a field instead of/aswell as using data from other tables.I hope you understood my questions.Cheers
View 3 Replies
View Related
Nov 3, 2013
I get an error "update or cancel update without add new or edit" which seems to point to this code.I am using MS Access 2010.
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Store when record was last modified and by who.
'Initially stores when the record was entered.
If Me.NewRecord = True Then Exit Sub 'Exit if new record
Me.DateLastModified.Value = Now()
Me.LastModifiedBy.Value = getUser()
End Sub
View 2 Replies
View Related
Mar 30, 2006
I am trying to stop access displaying the "You are about Update 1 Record" etc message when i run an update query. I know i can do this in Tools/Options screen but the problem is that the database is going to be used by multiple users, and rather than changing each persons Action query option I was wondering whether there is something i can put in to the code Globally to halt the message.
Any help would be appreciated.
Regards
Mark
View 2 Replies
View Related
Feb 10, 2008
I am trying to remove random characters from a field. The field [assycode] contains a string similar to say, FGEJBF1 or ABFGYRUKC I want to remove any occurrence of "F1" normally at the end of the string but not always at the end. I used: Like "*f1*" to find the correct records, that worked fine, I then used [Assycode]-" f1" in the update to box, It wants to update 146 records I click ok then it says It couldn't due to a type conversion error. Just messing around I tried adding "F1" to these records using [Assycode]+" f1" and it worked fine. Can anyone point me in the right direction?
Thanks in advance
Wayne
View 5 Replies
View Related
Oct 3, 2007
I have a database where two tables contain information that I need to update based on the 4 right most digits of a field. There are only 11 values that will need to be updated out of a large list of values. I'm not quite sure how to set up the update query so that I can do this.
View 1 Replies
View Related
Aug 22, 2013
I have a table called tblCompanies. When a company acquires another company, I need a method by which the acquired company's CompanyID (PK) can be updated to the new company's CompanyID (PK). I also need to be able to update all related CompanyIDs (FKs) to the new value in related tables.
In cases in which the new company does not have an existing record, there is no problem: the company name simply gets changed to the new company and the existing CompanyID is maintained. I then use an audit table and Track Changes function to keep track of the company name data and a union query to keep the old names in the selection lists.
The problem is when both companies already have existing records in the table.
So, let's say I have records for Company A and Company B. Company A merges with Company B and Company B is now the main record. What is the best, simplest and easiest way to update the CompanyID (PK) from A to B and change the CompanyID (FK) to the new value in all related tables?
I am envisioning a pop-up form that directs the user to select the new company and then an update query happens behind the scenes... but exactly how does the criteria for the update query get selected and how do all the related tables get updated? My vba skills are pretty basic, will I need extensive coding to do something like this?
View 6 Replies
View Related
Aug 16, 2005
I have two tables, each has a "status" for a project. In the left table there is only one instance of each set, but in the right hand table, each set may be used more than once by different Projects.
I need the Status field of the left table to be set to "Assigned" if ANY of the sets assigned to projects in the right hand table are "Assinged"
Here is the update query I have setup but when it runs, it updates "0" rows.
8 is the id for the status "Assigned" in the SetStatus table
2 is the id for the status "Assigned" in the Status table.
http://img166.imageshack.us/img166/8181/temtinv00210fp.jpg (http://imageshack.us)
View 6 Replies
View Related
Sep 29, 2006
Hi,
I read on the Access help about the 'Before Update' property; however, I still don't understand what it does.
Any help will be very much appreciated.
B
View 5 Replies
View Related
Oct 6, 2005
Hi:
After I made the query "T1",
I made another query "T2", but this query need query "T1" to work with.
So, when I change the query name from "T1" to "table1", I need to open the query "T2" to add the "table1" and remove the "T1" and change the table name in the query.
So, how can I update the query name? Because "T1" is same "table1' query. I just change the name, change name cause another query does't work. How can I update the query info.?
Thanks.
View 2 Replies
View Related
Nov 22, 2006
Hi Guys,
Two Tables:
module
workbook2
UPDATE workbook2 INNER JOIN [module] ON workbook2.ID = module.ID SET workbook2.bankimpid = module.BAImpID
WHERE ((([BASortCode])=[Sortcode]));
Any ideas why this changes 0 records when some records contain the same data in BASortCode and Sortcode??
Cheers
View 1 Replies
View Related
Feb 2, 2005
I can never get this right and it's frustrating.
I have a field on the form called OverallProjectStatus - it's a combo box and it has values: green, yellow, red.
If a user selects green as a value I would like BackColor of the form to turn green color.
I tried both before update and after update events on this combo box as well as on the form's before and after update events and it's not working.
Could someone please help me put this code in the right place.
If Me.OverallProjectStatus = "Green" Then
BackColor = 13434828
End If
Thanks!
View 2 Replies
View Related
Feb 10, 2005
Can someone tell me if this is the correct/best way to do this.
I have a calculated field "savings". It is calculated on the AfterUpdate event of the "month" field.
I have 2 text boxes (std cost & quoted cost) that have manually entered amounts and one combo with "modules" To get the savings calculation my code looks at the month selected then the module selected in my query and sums up the volumes.
It then multiplies the volume X the std cost minus the quoted cost.
Std Cost Quoted cost Dif Volume Savings
3.00 1.5 1.5 200 $300
Anytime any of the four fields change (std cost, quoted cost, module or month) I need the Savings field to recalculate.
My first thought is that I need to put in the same code calculating the savings in the AfterUpdate event of all of these.
Is that the case? What better way is there?
Thanks!
View 1 Replies
View Related
Nov 21, 2005
I have a form that has a combo box, once a user selects the required entry it the form performs several tasks after update.
If the required entry isnt listed the user clicks on the add button which opens a form to fill in the necessary details for that entry. Once complete the user clicks on the save button and the form closes updating the combo box on the previous form. But the after update tasks do not happen.
I have tried things like....
[Forms]![Frm1].reload
[Forms]![Frm1].refresh
etc
But cant seem to get it to work. Any ideas?? Thanks
View 2 Replies
View Related
Jan 12, 2005
Hey Guys,
I had a problem a while ago about changing the value in one field and having it update a different field in another table.
I have a table Order Details where I want the user to be able to select a quantity when ordering a particular shoe.
I then want a field named UnitsOnOrder in a table Products to update its value based on the amount ordered by the user in the quantity box in the other table.
The Order Details table is a subform not that it makes any difference.
I started receiving help by a Mr M Walts, but he hasnt been around for ages and I'm so very deperate for a fix as the code isnt working correctly and I've no idea how to fix it.
Private Sub Quantity_AfterUpdate()
'will hold the SQL which will update the Products table
Dim strSQL As String
'will hold the new total quantity after the change
Dim intChange As Integer
'see if the quantity had a previous value, might have to seperate into two
'nested if's if it gives an error on the second part of the condition
'when OldValue is null. It might
If Not IsNull(Quantity.OldValue) And (Not Quantity.OldValue = "") Then
'ok, there is a previous value, let's see which is bigger
'the change will be the new value - the old value
intChange = Quantity.Value - Quantity.OldValue
'ok, now we have the value that needs to be added to the
'quantity, if the old value was bigger then it will be negative
'which is what we want
Else
'if there was no old value, then all the really need to do is get the
'new value as the change
intChange = Quantity.Value
End If
'ok, now we create our SQL statement.
strSQL = "UPDATE Products " & _
"SET Products.UnitsOnOrder = UnitsOnOrder + " & intChange & _
"WHERE Products.ProductID = " & ProductID.Value '<- or whatever your control on the form is
'called that is bound to your productID field in
'the order details sub-form
'now we have created the SQL we need, time to run it
CurrentProject.Connection.Execute strSQL
'uncomment the next line to see the SQL that was generated
'debug.print strSQL
'that should do it for the first one, and it should give you an idea of how to carry on
End Sub
That is the code. I get an error message upon leaving the field sayin 'one of the required parameters is missing'
Any ideas?
Any help greatly appreciated. I'm way behind the rest of my I.C.T class as they have al finished their projects.
Surely somebody knows the answer
THanks in advance
Chris Tempest
View 14 Replies
View Related
Apr 11, 2006
I have a customer table with all the usual customer details (customer ID, name, address etc...), a transaction table (Transaction ID, Order Number, Customer ID, Title ID, Date, Status (order received, payment taken, ready for dispatch etc...)), and i have a Title table (Title ID, Artist ID, Name, Record Label, Quantity, etc...)
what would be the easiest way to update the title table everytime a new transaction was added to tblTransaction so that the quantity field in tblTitle would go down by one for the right title?
View 1 Replies
View Related