Multiple Update Using Dao

Jul 5, 2005

ok, here is the code i've got...

Code:Dim DAOdb As Database Dim DAOrs As DAO.Recordset Dim sSQL As String Set DAOdb = CurrentDb() 'select the record corresponding with the value in the hidden textbox sSQL = "Select * from table where field =" & "'" & Me.textbox.Value & "'" & ";" Set DAOrs = DAOdb.OpenRecordset(sSQL) With DAOrs .Edit 'update this field in the table .Fields("Status") = "Complete" .Update End With DAOrs.Close DAOdb.Close
i want to be able to update all of the fields that match the textbox. as it is now, it only updates one. how can i loop through all of the records and update all of the ones that meet the criteria??

thanks for your help. It's greatly appreciated!

*j

View Replies


ADVERTISEMENT

Forms :: Inventory - Allow Users To Update Multiple Fields For Multiple Assets

Sep 25, 2014

I want to create a form that allows users to update multiple fields for multiple assets. Below is what I came up with:

Ideally, I'd like the subform to be filled in by having the user select multiple Assets from the S/N combobox field which would then auto-populate the "Type" field. Then they would fill out the appropriate fields they want edited in the top part of the form. They hit save and magic happens. This would also be nice because only assets they want edited would be displayed (easier on the eyes) and no distinguishing would be necessary. To do it this way, I know I would need to use a temp table but I wanna avoid using temp tables.

I know I can do this by adding a Yes/No field in the "Asset" table, setting the "Asset" table as the subform's recordsource, and then putting a checkbox in the subform and allowing them to check the assets that they want to edit (which would also allow me to sort it instantly so that checked Assets are at the top of the datasheet for easy viewing), but I would like to know if there's a way of accomplishing this without the use of checkboxes.

I know I could also use a listbox and that allows them to multi-select items, but I'm not sure if that allows me to group all selected items at the top of the listbox for easy viewing of selected items. Plus it would involve a lot of scrolling (there are over 2k assets).

View 2 Replies View Related

Multiple Update To Same Field

Sep 6, 2006

Hi, I have created a field called age, where I have a formula that takes the date of birth out of the IDENTITY NUMBER and calculated the peoples age, I have then created a field where I would like to allocate groups depending on their age, i.e, 18-25 = Group1, 26-35 = Group 2,etc... I am having trouble with this, firstly, I cannot get the formulas to work individually and secondly, I get an error that says I have duplicate fields to update.

PLEASE HELP!!!!

View 2 Replies View Related

Update Multiple Fields At Once

Sep 6, 2007

Hey guys-
I have 2 identical tables. I want to update the data from Table1 to go into Table2. Each table has well over 70+ fields in them. Instead of handwriting out each [Table].[Field] in either SQL or the Designer- is there a shortcut to tell Access to grab all the fields from Table1 and update all the fields in Table2 (all the fields have the same name)? I just don't have the energy to type it all out- I figure there's got to be a way...

I know when you do an APPEND query in the designer- it will do this for you- but not the UPDATE query...
Thanks!

View 6 Replies View Related

How Can Update Multiple Records??

Sep 13, 2005

Hello,
I would like to update multiple records in one query.
The scenerio is that i have 3x3 (3 in row and 3 in column) text feilds and i want to update it once, in one query after entering the data in text fileds.
Can anybody help me please......????

Waiting of your quick reply.

View 3 Replies View Related

Update Multiple Product IDs

Feb 21, 2012

I've got an order detail form which has

product id, product description, customer, quantity and below the form a Total quantity

When I enter the same product id, and when i press the button to update, the table of stock quantity deducts from total quantity

If I use different product ids, it doesn't work, but updates only the current product id, where the mouse current record is set by mouse.

By the way i use dlookup to check if the stockquantity has enough items.

View 10 Replies View Related

Update Multiple Tables In One Go

Dec 6, 2011

I need to update data in an Access database(ADO,VBA).

In the Access database, there are three tables as following:

Unit(ID,UName,TID,AID)
Type(TID,TName)
Area(AID,AName)

When a unit has changed its type or area, then the db needs to be updated. My question is how to do it. Can I get a recordset by joining three table, and do the update in one go?

View 8 Replies View Related

Update Multiple Forms/tables

Apr 7, 2006

I would like to create a text box where I can input todays date, then I want to be able to select the tables I want to update with that information.
So if I input todays date I can then update my Stock, Sales and Control tables with todays date. Tomorrow I would only like to update the Control and Tape tables with it as its the weekend.
I been playing around with 'new date for next record' scenario but the problem is that on the weekend we would not input any data into some of the tables.
Hope I've explained myself clear enough.

Thanks

Tim

View 3 Replies View Related

Update Values In Multiple Tables

Oct 26, 2005

I am developing an access db where employees are allowed to load tools from a tool store.

I have three tables: tblEmployee, tblTool, tblOnLoan.

tblTool includes a field "QtyOnHand" which is the quantity of a particular tool in store available to be loaned.

tblOnLoan is used to record which employee has what tools on loan.

When an employee loans a tool i need to be able to reduce the QtyOnHand of the tool and record the loan details in tblOnLoan.

When the employee returns the tool i need to increas the QtyOnHand of the tool and record the return against the original loan in tblOnLoan.

i have not yet been able to work out how to reduce or increase the QtyOnHand as tools are loaned or returned.

Can anyone please help?

View 1 Replies View Related

Update Fields In Multiple Tables

Jun 27, 2005

I am trying to setup a database for vehicle stock control.
Im not sure if I have gone about this the right way as I am new to this but thus far it is working correctly except for one annoying problem.
The database consists of so far

tblIAWVehicleDetails (Primary key "IAWvehicleID" autonumber)
tblIAWSellers (Primary key autonumber)
tblIAWBuyers (Primary key autonumber)
tblIAWStates (Primary key autonumber)
tblIAWStatus (Primary key autonumber)
tblIAWSafetyDetails (Primary key autonumber)
tblIAWSold (Primary key autonumber)

In the Vehicle Details table a stock number has to be manually added as this will be used for new stock as well as current stock (Number range from 100 - whatever) "IAWVehicleNo".
This table contains all relevent data with reguards to make, model, bodytype, color etc.
The sellers table contains the details of the seller Name, address, Phone, LicenceNo etc.
The Buyers table contains employee names.
The States table contains all Australian states.
The Status table contains current vehicle status Retail, Wholesale, Wrecking etc.
The Sold table contains the details of the person who purchased the vehicle if sold.
The Safety details table contains a safety checklist for pre purchase inspections eg: Headlights yes/no checkbox, Headlight text field for any extra info.
It also has a field for a safety Certificate No once the vehicle is checked and recieves a Safety cert.
The forms are setup as
frmIAWVehicleDetails
frmIAWSellers Subform
frmIAWVehicleSafetyDetails
frmIAWVehicleSafetyDetails Subform

The Vehicle Details,Sellers,Sold & SafetyDetails tables all have the IAWVehicleID & IAWVehicleNo Fields but when the details are entered through the forms the IAWVehicleNo which is the manually entered number only updates to the tblIAWVehiclesDetails but the other IAWVehicleNo fields in the other tables remain blank.
Any advice or help would be greatly appreciated.

View 6 Replies View Related

Update Queries On Multiple Rows

Mar 16, 2007

Hi,

Is it possible to update multiple rows in a Table at one time using Update Query?

Ta
Kasey

View 5 Replies View Related

Update Multiple Records In Subform

Aug 11, 2005

Hoping that this is a simple problem :confused:

I have an orders form and subform, ie one order can have several product records with the following firlds
Product
Ordered
Received
At the bottom I have a command button 'ReceiveOrder'
What I want is on click of this button that the received field (that is 0 by default) will equal Ordered.
ie If I had orderd 2 and I hit the button it would change the recieved to 2 as well.
This much I have done with the following code
Private Sub ReceiveButton_Click()
Me.frmReceivingSubform.Form!QtyReceived = Me.frmReceivingSubform.Form!QtyOrdered
End Sub

This work fine if there is only one product, but if I have more than one it will only update the selected record, is there an ammendment I can do that means all the product records on that particular order will update.

I've searched the forum for the answers but can't find the answer, can anyone help,
Thanks

View 6 Replies View Related

Multiple Checkboxes To Update Table

Aug 30, 2005

hi, i've a form with 2 combo boxes (month and year) and 2 buttons "save" and "get". I'm trying to figure out how to use that button to perform 4 tasks.

task 1:

when i select the month and the year from the combo boxes and i click the button "get", the form should populate the number of checkboxes equavalent to the number of days of that month. e.g: if i select feb 2008, i should have 29 checkboxes (due to leap year) or i select apr 2005, i should have 30 checkboxes.

assuming that i've done the date validation function.. like jan, mar, may, jul, aug, oct and dec should return 31 days, leap year etc.

task 2:

then how should i assign the date value to the checkbox? say if i check on the 5 th box, it should return me a value of 05/09/2005 (assuming i select sept in my month combo box and 2005 in my year combo box earlier on)

task 3:

how should i code the label for my checkboxes? i wan to have 2 labels on top of the checkbox. the first label to show the name of the day (e.g: mon, tue etc) and the second label to show the day (e.g: 1, 2, 3)

task 4:

not sure if this task is a tall order.. but nonetheless, i need to consult the experts here. let's say when i check multiple checkboxes at one go, how to update into the table i want?

e,g: i check 9 boxes (e.g: 01/09/05, 03/09/2005, 04/09/2005... 23/09/2005) then when i click the button "save", i should have nine records in my table designated to save the data.

pls help. thanks. :)

View 11 Replies View Related

Combining Multiple Update Queries Into One.

Mar 12, 2007

I have a table with a field called "description"
another field in fame table called "length of cable"
In description field it contains among other things, the length in it . It may be at various locations in the test data in the field. The length may be in the form xft or xxft xx foot xxfeet xx feet..


I have another field that I need to put the length in a standard form like xx feet
(The field will have different units in it later not just feet.)
I am using update query
with
criteria of Like "*3ft*" Or Like "*3 foot*" Or Like "*3 ft*" Or Like "*3 foot"
with update to (of the length of cable field ) set to 3 Feet
The data has many lengths
1ft
2ft
3ft
4ft
5ft
6ft
7ft
10ft
12ft
14ft
15ft
20ft
25ft
and one....

I would like to automate it to one query and hopefully avoid the problem I have when doing it as is, *5ft* also finds 25ft and 15ft incorrectly for the goal of the update. same on 12ft 14ft

' and " are the symbols for inches and feet.
Also some of the data is in the form xx' or xx" I hit a wall on this due to the ' character
need to do the same to that as well.

Any suggestions '''
before I lose any more hair ...

View 6 Replies View Related

Modules & VBA :: Update SQL With Multiple Where Clause

Sep 29, 2014

I have an update sql statement that isn't quite working properly.

My where clause has 3 criteria.
*print = -1
*stDocCriteria (project_num and client_id)

Below is what the code looks like.

Code:
updateSQL = "update tblTimedTasks set printed =-1, invoice_date = Now() where print = -1 and " & stDocCriteria

Add watch: so you guys can see "stDocCriteria"

Code:
updateSQL = "update tblTimedTasks set printed =-1, invoice_date = Now() where print =-1 and ([project_num]= '140012' And [client_id] = 87)"

I want to only updates records that meet all three criteria. The above sql not only updates all records that satisfy stDocCriteria regardless if print is -1(true) or 0(false).

View 10 Replies View Related

Forms :: How To Update Multiple Row In One Table

May 19, 2013

how to update multiple row in one command button e.g. cmdsave.Example as below: Table Name = Master

PRNUMBER PONUMBER QTY
123456 RLP120001 12
123457 RLP120001 45
123458 RLP120002 23

How to save both RLP120001 with status "OK" because normal form only can have one form with one data. Then, I come out with filter form which can view PO number RLP120001 but how to update both PO Number using filter form. In my filter form, save button only save above row which pr 123456.

View 1 Replies View Related

Update Query Covering Multiple Tables

Jan 25, 2006

Hello everyone! I am constantly have to change a field, called Product_Code, that resides on multiple tables. To change the field I have to run a series of 9 update queries. I'm looking for a way for all these updates to occur at the press of one button on a form. So I would set my criteria using fields on the form that correspond to the appropriate fields on the query and when I press the button all the updates would occur. My question is what is the best way to go about programming this form and is a form my best option to accomplish my goal. I hope I have explained this thoroughly enough...if not I am more than willing to answer any and all questions in order to get this task automated. Thanks everyone.

View 3 Replies View Related

Update Query Same Field Multiple Criteria

Jan 12, 2007

Hello,

Was wondering if there is a way without building individual update queries, to update info in one field that has multiple criteria ?

Basically I need to change/update daily multiple ID numbers to new ID numbers, long story on why this needs to be done but for now I need to do it this way.

Example: 12345 update to ABCDE, 6789 update to FGHI, etc. These ID's are all within the same field in the table.

It works fine running each ID one at a time but was wondering if it is possible to do all these updates within one query or code ?

Thanks for any assistance

View 6 Replies View Related

Updating Multiple Rows In One Update Query Help Please!

Mar 7, 2008

I have one table, I want to update multiple fields in that Table with values.Currently I have on update query for each update.So for exampleRows: Commercial Quotes, Cover Notes, Personal QuotesWill have the values: Yes, No, Yes in them.I need to update those fields, if they say Yes to Commercial Quotes, Cover Notes or Personal Quotes depending on the field obviously. And blank them out if it says No.Currently I have 30+ different queries I have to click individually one after the other to update each row. I was wondering if theres a quicker way of doing this all in one hit.I have a tiny bit of SQL knowledge.So one of the queries I've figured out I've converted to SQL but again it only updates one instance...UPDATE Enabler_Data SET Enabler_Data.[Commercial Quotes] = "Commercial Quotes" WHERE (((Enabler_Data.[Commercial Quotes]) = "YES"));I tried whacking an OR replacing the ; and repeating that statment replacing Commercial Quotes with Cover Notes but it errored out on me.This is where I get completely stuck and my meagre knowledge fails me so any help would be useful.Thanks in advanceMatt

View 14 Replies View Related

Update Query-multiple Fields,1 With Data, 1 Without

Apr 10, 2008

Access2007- Building a query to handle future input...

I run an update query that does what it is supposed to do and gives the proper values.

THEN I add a one more field to the source with the builder using + that has no data in it yet, the query fails and gives blanks, even though one of the fields in the source has data in it.

I would think that the "no data" field would be considered 0.00 value and be added together to the field that has values giving at least the value of the field with values as a result of the query.

Is there a setting somewhere that I need to change so that the no value and the value would be combined? I am using the builder to combine the values in the query.

Thanks.

View 2 Replies View Related

Help In Insert/update Multiple Selection From A Listbox

Aug 7, 2005

thank you in advance for all your BIG help. :)

I have 3 tables - SMaster, SI_map, ILookup

I need to create a form to Add/Update into SMaster and SI_map tables, which has one-to-many relationship, that's why I use a list box to show the values from SI_map.

in SMaster [ Sid, other fields ]
in SI_map [ primary key, Sid, ILookupid ]
in ILookup [ ILookupid, IName ]

questions:
1. How to get the multi-selected values from the list box?
2. insert these multiple records into SI_map table at the same time with SMaster (if I use the same form to populate all these fields)
3. how to populate the records into form for user to see and update the values?

Any suggestion is appreciated, it is very flexible to change any format such as SMaster and SI_map can be separate forms, as long as it works.

Thank you.

View 3 Replies View Related

Update Form Based On Multiple Tables

Feb 9, 2006

My db has several tables tb1, tb2 tb3 tb4 ..... I have link tb1 to tb2 (tb1Id to tb2)and linked tb2 to tb3 and tb4 (tb2Id to tb3 and tb4)
I have created a form with several field from tb1 and tb2 and a single field for tb3 and tb4. All of the fields except one for tb1 are use to make a decision based on what they display. The only field that is updated on the form is a date conversion field from tb1. once you update this field it will auto populate a date field on tb1 with current date. you then have a choice of 4 commands to activate based on what is displayed form the rest of the form.

my problem none of the fields can be updated. can any one help

qry the form is based on

tb1 [Name]
tb1 [ID]
tb1 [date conversion] 'this is the only field that is manualy updated
tb1 [date] 'updated base on date conversion field being updated
tb2 [field]
tb3 [Yes/no]
tb4 [yes/no]

based on what is displayed on the form you have 4 choices of cmd buttons.

View 1 Replies View Related

Write/update Multiple Lines Belongs To A PO?

Apr 18, 2008

Hello all,

How are you? Hope everything is well!

I have a question. If I have a form, which has underlying source is the table LineItem. The table has these fields PO#, Line Item, Cancel check box, and Cancel Reason list box. Each PO can have 1 to multiple line items. Once in a while, the users need to cancel certain line items and type a reason in the Cancel Reason box. When the users click the Cancel check box, it force the user to enter a reason.

However, in cases, some POs have 10-100 line items, and the reason are the same for all line items, and it is time-consuming and tedious to do one by one. I would like to find a way to enter reason in line 1, for example, and copy/update the rest of line items in that same PO with that.

Please advise HOW and WHAT COMMAND should I use to update the text in one field of one record (line item) to ALL other records (line items) in the same PO.

Please help! Thanks so much.

View 3 Replies View Related

General :: Add And Update Multiple Records To Different Tables

Jan 12, 2013

I have a pretty normalized Access Database. The table that I am trying to add new records is tbl_returns and has 4 fields: return_ID, serial, reason and inv_num.

When I sell a card (or a range of the cards) an invoice including all the information is saved as a record in a new row in tbl_invoices.

If a vendor wanted to return a card (or a range of the cards) in the next visit (weeks or months later) I will accept and in most cases they want me to switch the cards with new ones. Therefore in a new invoice (different date and invoice number) I will give him new cards and return the cards that he wanted to change or return.

Now I have to assign NULL to the inv_ID field in tbl_allPins in order to make it available for sell in future. At the same time I want to have a record of the returned cards including serial number , the reasoning of return, invoice number and/or a little note about each one/range of the card(s).These are to be recorded in tbl_returns as you can see.

For instance you want to return serial numbers between 9876 and 9880 (includes 5 cards) because of the "scratch off problems" and your invoice number is 22222, using frm_returns. After you process it and then open the tbl_returns to check the result, you will see 6 records are added instead of 5. I was able to understand why it is happening (I believe so!) but I could not fix it. Also I cold not write a VBA to remove the inv_ID in front of the related serial numbers in tbl_allPins.

Also in another trial was ended up to creating the Form1. Form1 looks better (has no extra records) but I have trouble to navigate through the records in tbl_returns. There was a sub-form added but it was showing all the records in tbl_returns which is unwanted.

By the way, serial numbers and PIN numbers are each a unique number in tbl_allPins.

View 3 Replies View Related

Queries :: How To Conditionally Update Multiple Columns

Mar 29, 2013

I have a databse of bird ringing (banding) which I have turned into an encouter history by using the pivot table capability in MS Access. Example attached.

For each animal, identified by a ring number in column B, there is a set of "encounters" over time. A blank in a date column indicates that the animal was not seen or captures in that year. A number in the column indicates that it was seen or captured n times.

To format these data correctly for subsequent surival probability analysis, I need to replace all of the blanks, in each of the "year" columns with a 0 and anything that isn't blank (e.g. 1, 2 or 3) with 1. So, I need columns F to L to look like C to D.

It was simple enough to do this one column at a time...

UPDATE [Capture history intermediate] SET [Capture history intermediate].[1971] = "0"

WHERE ((([Capture history intermediate].[1971]) Is Null))

But I have a lot of data, spanning 40 years (i.e. 40 columns) and I will probably have to do this conversion many times as I work on sub-sets of my master database.

So, question is, is there a short-cut way to avoid having to create 40 different queries and run each one seperately?

View 3 Replies View Related

Queries :: Update Command Multiple Tables Using IIF

Aug 10, 2013

I am writing a sql to assign students to each section of a course. The first student would be in the first section and the second student in the second section.

The ClassParam table gives the number of sections for the course and the last period that was assigned.

The Classes table gives the class key number by class name and section number.

The student has the name of class they want to take and I want to move the class section number into the Choice1 field.

The IIF statement seems to work but all of the students are getting the 1st session of the class put into the choice1 field.

UPDATE Students, ClassParam, Classes SET Students.Choice1 = Classes.ClassID,
ClassParam.PeriodAssigned = IIf([ClassParam]![PeriodAssigned]>=[ClassParam]![NumOfSections],1,
[ClassParam]![PeriodAssigned]+1)
WHERE ((([Students]![FirstChoice])=[Classes].[ClassName] And ([Students]![FirstChoice]) Is Not Null And ([Students]![FirstChoice])<>"") AND (([ClassParam]![PeriodAssigned])=[Classes].[SectionNumber]) AND (([Classes]![ClassName])=[ClassParam].[ClassName]) AND ((ClassParam.ClassName)=[Students]![FirstChoice]));

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved