473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

update multiple records

I have a date closed field on a form. How do I make this field update multiple records. For example. I have books database. I have multiple books checked out with a date. I want to update the checkout date from my checkout form on multiple records which is a continuous form. Please help
May 26 '16 #1
5 1330
I have attached my DB. I need to update all the records that have been selected for checkout with the checkout date from above. Somebody please help, I need this for my job. Thanks.
Attached Files
File Type: zip Books.zip (41.5 KB, 61 views)
May 26 '16 #2
PhilOfWalton
1,430 Expert 1GB
Firstly, I think your FPrint field should be a Y/N field, not a text box. This would change the form to having a check box.
So you would select the books that you want to apply the checkout date to by "ticking" the check box.
Secondly you need a Command Button on your form that would then run the routine to update the records with the checkout date.

Questions:

What do you want to do if there is already a checkout date against a book?

How many books are there: is the list going to be impossibly long?

Phil
May 26 '16 #3
jforbes
1,107 Expert 1GB
There are a few different ways to go about this.

One is to use a RecordSetClone of your Form and iterate through all the records, and update the Date. Here is an example that updates an Integer field:
Expand|Select|Wrap|Line Numbers
  1.     Dim oRst As DAO.Recordset
  2.     Dim iCount As Integer
  3.  
  4.     iCount = 0
  5.     Set oRst = Me.RecordsetClone
  6.     oRst.MoveLast
  7.     oRst.MoveFirst
  8.     Do While Not oRst.EOF
  9.         iCount = iCount + 1
  10.         oRst.Edit
  11.             oRst!PrintIndex = iCount
  12.         oRst.update
  13.         oRst.MoveNext
  14.     Loop

Another is to build up a SQL Update Statement in VBA and then call CurrentDB.Execute:
Expand|Select|Wrap|Line Numbers
  1.     Dim sSQL As String
  2.     If Len(Me.Filter) > 0 Then
  3.         sSQL = ""
  4.         sSQL = sSQL & "UPDATE Drawings SET LastModifiedDate=#" & Now() & "# "
  5.         sSQL = sSQL & "WHERE " & Me.Filter
  6.         CurrentDB.Execute sSQL
  7.     End If
May 26 '16 #4
Basically the check out date in my real dB is a destruction date. I would ultimately like to have that record archived somehow once there is a destruction date. as far as records, eventually there will be anywhere from 0-200 give or take. I really appreciate the help, I'm still kind of a novice at this, and can use all the help I can take. I really enjoy designing databases and want to learn all I can.
May 26 '16 #5
NeoPa
32,556 Expert Mod 16PB
I've merged these two threads as we forbid double-posting of questions here.

Unfortunately, neither attempt seems to be well enough expressed to make good sense on its own. Hopefully together they do.

@Gary.
It's your responsibility to ensure your questions are clearly laid out when you post your question originally. If, as you say, it's important for your job, then it's particularly important for you. Poor and lazy questions are far less likely to get sensible answers as the experts will struggle to match the answer to the question.
May 26 '16 #6

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

Similar topics

2
by: Olivia Towery | last post by:
SQL 6.5 Database I have a list of registrants and I want to use a check box after each record to show those who attend and then post all with one submit button. Any help is appreciated. --...
4
by: Mark S. | last post by:
Hi, I have a weird UPDATE sequence I want to perform. The customer does not want to use INSERT and DELETE. My issue is that there are multiple Mat_Class, but I do not wish to hard code each one...
1
by: A P | last post by:
How can I go about updating multiple records or deleting multiple records from a DB at a time?
1
by: Kenneth | last post by:
Dear all, How can I update multiple records in using ASP.NET? Currently I have a table which require to update frequently but I can update records one by one using DataGrid. Kenneth
1
by: jayz24 | last post by:
Hi everyone! I'm new in this forums and new in the line of programming..A Beginner.. I have a problem, I don't know how to populate a multiple updates. Anyone who have codes for this? Here's...
1
by: jllopez | last post by:
I need update multiple records in the datagrid but this is using ASP.net and VB, somebody that I can help?
1
Fary4u
by: Fary4u | last post by:
how can i update multiple records corresponding to perticular ID & update values in one go ? mode_a contains ID No. Dim mode,mode_a,i mode=Request("t1") mode_a=split(mode,",")
1
by: saifulhaque | last post by:
Hi Dear How can insert, Display ,update multiple records simultaneously through GridView in Asp.net. I have Button for insert, update . I want insert, update multiple records through a GridView...
14
by: Diana Miller | last post by:
Hi All, I have an Access 2007 report where the user selects a date from a combo box. After selecting the date, I need the AfterUpdate() event of the combo box to fill in text fields with a...
2
by: IngePTE01 | last post by:
Hi, I have an existing database that I would like to edit. At the moment our system only allows me to update one record at a time, but I have jobs that could have up to 200 records per job that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...

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.