I have a table with about 100 records. The user has the ability to click a button on the main form that will open up a "move to the next year" form. A query displays all 100 records on the continuous form. The user can then checkbox which record he/she wants to move to the next year.
Here's my question....
How do i check which checkboxes were checked and ONLY move those that were checked? Also, the table that it pulls from is a linked table, linked to the server...when the user hits the cancel button on the form, i try to run an update query to reset all of the checkboxes to false, but the query hangs there b/c it won't let me update. Is there a better solution for this as well?
Here's my code so far on the form that doesn't work. As of now, the only record that will be moved to the next year when the "Move" button is clicked is the current record selected. How do I check which checkboxes are checked? - Private Sub cmdMoveto1_Click()
-
MoveFeedersOnceRightInBudgetPlan Right(cmdMoveto1.Caption, 4)
-
End Sub
----------------------------------------------------------------------------------------------------------- - Public Function MoveFeedersOnceRightInBudgetPlan(yearToMoveTo As Integer)
-
-
'Desc: When feeders are moved from year to year in the budget '
-
' plan, depending on certain factors, records may have '
-
' to be kept on why the feeder(s) was/were moved '
-
-
If Forms!frmMoveMultipleFeeders!chkMoveFeeders.value = True Then
-
'Save all records that might have been changed
-
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
-
Dim CurrentYear As Integer
-
'Set CurrentYear to the value of the current year
-
CurrentYear = Forms!frmPlan!txtYear.value
-
-
-
If Year(Forms!frmPlan!frmPlanList.Form.Controls("PlanDate").value) = yearToMoveTo Or _
-
Year(Forms!frmPlan!frmPlanList.Form.Controls("PlanDate").value) <> CurrentYear Then
-
-
MsgBox "You cannot change the date from here." & vbCrLf & "To reschedule this line, press the Requery Plan button and goto the year that matches the plan date."
-
Exit Function
-
End If
-
-
-
'The user is trying to move something into or out of current year, a record needs to be kept on why the
-
'feeder is being moved. This is done thru frmPlanMove
-
If isPlanLocked(CurrentYear, Forms!frmMain!frameDivision.value) Or isPlanLocked(yearToMoveTo, Forms!frmMain!frameDivision.value) Then
-
-
DoCmd.OpenForm "frmPlanMove"
-
'Copy values from frmPlanList to frmPlanMove
-
Forms!frmPlanMove!FdrID.value = Forms!frmPlan!frmPlanList.Form.Controls("FdrID").value
-
Forms!frmPlanMove!lblFeeder.Caption = Forms!frmPlan!frmPlanList.Form.Controls("FeederName").value & " - " & Forms!frmPlan!frmPlanList.Form.Controls("FeederNumber").value
-
Forms!frmPlanMove!NewPlanDate.value = DateAdd("yyyy", yearToMoveTo - CurrentYear, Forms!frmPlan!frmPlanList.Form.Controls("PlanDate").value)
-
Forms!frmPlanMove!UTMiles.value = Forms!frmPlan!frmPlanList.Form.Controls("UTMiles").value
-
Forms!frmPlanMove!UTCost.value = Forms!frmPlan!frmPlanList.Form.Controls("UTCost").value
-
Forms!frmPlanMove!RTMiles.value = Forms!frmPlan!frmPlanList.Form.Controls("RTMiles").value
-
Forms!frmPlanMove!RTCost.value = Forms!frmPlan!frmPlanList.Form.Controls("RTCost").value
-
Forms!frmPlanMove!MTMiles.value = Forms!frmPlan!frmPlanList.Form.Controls("MTMiles").value
-
Forms!frmPlanMove!MTCost.value = Forms!frmPlan!frmPlanList.Form.Controls("MTCost").value
-
Forms!frmPlanMove!RLMiles.value = Forms!frmPlan!frmPlanList.Form.Controls("RLMiles").value
-
Forms!frmPlanMove!RLCost.value = Forms!frmPlan!frmPlanList.Form.Controls("RLCost").value
-
-
Forms!frmPlanMove!LowDate.value = "1/1/" & yearToMoveTo
-
-
'There are two sets of reasons.
-
-
'Moving Feeder out of current year
-
If CurrentYear = getPlanStartingYear Then Forms!frmPlanMove!Reason.RowSource = "SELECT tblPlanMoveReason.ReasonID, tblPlanMoveReason.Reason FROM tblPlanMoveReason WHERE (((tblPlanMoveReason.MoveIn)=False));"
-
'Moving Feeder in to current year
-
If CurrentYear <> getPlanStartingYear Then Forms!frmPlanMove!Reason.RowSource = "SELECT tblPlanMoveReason.ReasonID, tblPlanMoveReason.Reason FROM tblPlanMoveReason WHERE (((tblPlanMoveReason.MoveIn)=True));"
-
Forms!frmPlan!frmPlanList.Form.Requery
-
Else
-
Forms!frmPlan!frmPlanList.Form!PlanDate.value = DateAdd("yyyy", yearToMoveTo - CurrentYear, Forms!frmPlan!frmPlanList.Form!PlanDate.value)
-
End If
-
Exit Function
-
-
End If
-
-
errorHandle:
-
If Err.Number = 2105 Then
-
Exit Function
-
Else
-
MsgBox (Err.Number & " " & Err.Description)
-
End If
-
-
End Function
Thanks in advance for your help!!
8 3086 Rabbit 12,516
Recognized Expert Moderator MVP
Whether the tables are linked or embedded, residing on a server or not, as long as you have read/write permissions you should be able to update those tables. The query shouldn't hang if the query is set up properly.
As for moving the records, just run an append query that selects all records that have the checkbox checked. And then run another query to uncheck the records.
As for moving the records, just run an append query that selects all records that have the checkbox checked. And then run another query to uncheck the records.
But I don't want to move the data from the table the query is pulling from to another table. I just want to change the data in the year column that's listed within the same table, while also allowing the user to insert comments on a pop-up form as to why they are wanting to move the record. My code shows something to that effect, but right now, only applies to the current record SELECTED, not checked.
Rabbit 12,516
Recognized Expert Moderator MVP
Did I misunderstand when you said "How do i check which checkboxes were checked and ONLY move those that were checked?"
Did I misunderstand when you said "How do i check which checkboxes were checked and ONLY move those that were checked?"
Well, when I said move, I mean change, like, leave the other records alone that weren't changed (as in checkbox check change). When the checkbox is checked, there is a column within the table the becomes -1 while the others remain 0.
Example:
Record 1 is in the 2007 Budget Plan Query
Record 2 is in the 2007 Budget Plan Query
Record 3 is in the 2007 Budget Plan Query
Record 4 is in the 2008 Budget Plan Query
Record 5 is in the 2008 Budget Plan Query
Record 6 is in the 2010 Budget Plan Query
The user has specified by clicking the 2007 radio button that he/she wants to view the 2007 Budget Plan. The user sees Records 1, 2, and 3 and doesn't want them to show up in his/her 2007 Plan. So they have to use the record selector on EACH record and go through the process ONE AT A TIME of clicking the "move to 2008 Budget Plan" command button and entering their reason why they want EACH ONE to show up there instead. NOW, when they click the 2008 radio button, the record shows up in THERE instead.
I need a way of selecting all 3 at the same time!
there should be code for this, which i am unsure of still, like....
chkMoveFeeders. SetFocus
Move = chkMoveFeeders. Value If Forms!frmMoveMu ltipleFeeders!c hkMoveFeeders.V alue = True Then
something like that...?
Rabbit 12,516
Recognized Expert Moderator MVP
Can't you just have a BudgetYear field that they change? Changing that field should change the results of the queries.
Whether the tables are linked or embedded, residing on a server or not, as long as you have read/write permissions you should be able to update those tables. The query shouldn't hang if the query is set up properly.
As for moving the records, just run an append query that selects all records that have the checkbox checked. And then run another query to uncheck the records.
I see what you were saying now with the append query...
here's a question from someone else on google...
I have a database with training records in it and they each have several categories within. Example: Jones, Smith, Gordon, Jordan are all required to have a suicide awareness class annually. How can I update the date of the class for Jones and Jordan all at once? In reality, there are 200 records and the class is given 25 at a time and I don't want to have to update 25 at a time individually. Can I select 25 records and update the dates all at one time if the 25 users are from different departments, etc?
Thanks for your time.
Here's the answer...
Bruce,
Many thanks for the question.
To do what you ask, add a Yes/No field to the client record.
I have presumed there is a relationship between the client and training tables, if not create one.
Then create a form that list both the client and the training tables. You should be able to do this by following the form wizard. Choose a continuous form as the type of form. Add the fields that you require to make a decision about which records you wish to update, but be sure to include the new Yes/No field.
You can use this form to sort, filter etc by using the toolbar . Then just tick the check boxes of those clients you want to update.
Then make an append query by:
IMPORTANT: Make a copy of the table of which you wish to change the dates, in case something gets messed up. An update query cannot be undone once it has been run. (Right click on the table > copy then right click in some white space > paste)
In the query section click on New > Design View
Add the client table and the classes table. Close the add table window.
At the top of the query, click on Query > Update Query
This will add a new row in your query with Update to:
Add the following fields (by double clicking on them):
'date of class' , then in the update row type in the new date.
'Yes/No' field. Leave the update to row blank and in the criteria row type -1 (which is a Yes or a tick). Only those records you have ticked will be updated.
You can automate this by adding a command button to your continuous form, follow the Wizard and choose to open/run this append query you have just created.
You will need to change the date you have entered in the update to row: to [Enter New Date] this will prompt you to enter a new date each time the query is run.
Hope this is of some help
Regards
Julie
Thank you for your help again Rabbit...i'm a novice at this stuff and it kills me when I don't know what I'm doing or what I'm talking about, which is the case MOST of the time.
Rabbit 12,516
Recognized Expert Moderator MVP
Not a problem, good luck.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Sébastien |
last post by:
Hi there,
If I call mergeProfiles() only one time, it is fine. However, if I
call it more than one time (say twice), then it will returns a
segmentation fault... any ideas?
$res is a result of a call to mysql_query()
function mergeProfiles($res) {
|
by: Paolo |
last post by:
Friends, I have created a form named FRMNEWCLIENTS whose record source
is a table named NEWCLIENTS. This table has a field named FILENUMBER.
I have added on the form a combobox using the third option "find a
record based on my form based on the value I selected in my combobox".
This is great since it allows me to open the form and use the combo to
move to a selected records. My form has also two other fields named
FNAME and LNAME.
My...
|
by: Jan and Hugh Tonkin |
last post by:
I'm working on a membership database in Access 97 which has 4 datasets, the
main one listing current members.
When somebody ceases membership, I need to move that member's details from
the current members' dataset to one of the other lists within the
membership database.
At the present time we're having to laboriously enter the ex-member's
details in the new dataset and then delete his/her details from the current
member's set.
|
by: Prakash |
last post by:
Hi !!
In a Continuous Form with say 10 records, I'd like to have 1 button
with an "UP" Arrow & another button with a "DOWN" arrow. By pressing
either the Up or the Down Arrow, I'd like the user to be able to MOVE
the records up or down the order.
Something like in a WinAmp or MusicMatch Playlist.
A little sample code would be much appreciated.
|
by: jpzhai |
last post by:
Why the recovery to time is greater than the current time?
---------------------------------------------------------------------------------------------------------------------
Last committed transaction = 2006-08-23-22.09.40.000000
DB20000I The ROLLFORWARD command completed successfully.
db2 =connect to test
Database Connection Information
Database server = DB2/6000 7.1.0
| |
by: Simon |
last post by:
Dear reader,
How can I move the record pointer in a sub form.
The sub form is a datasheet type. Both forms have the same reference key.
How can I move the record pointer in the sub form to the key field as
specified in the main form.
|
by: None |
last post by:
Hi,
I'm facing a problem with static instances. I have created a
class called CustomList by deriving the class List<int>. Inside the
CustomList i have created Remove event (when any item is removed from
the List). After that i have created a staic instance for the
CustomList in my WebService class. The class contains the Start And
Poll Methods. Inside the Start method i have added the Removed event.
|
by: kimberlymikado |
last post by:
I am creating a database for a small travel agent.
I would like to move the record of a holiday which is in an AvailableHolidays table to a BookedHolidays table when a customer books the holiday, i would also like to add the CustomerID to the record in the Booked holidays table, is there an easy way to do this?
|
by: julietbrown |
last post by:
I was scolded on "Bytes" a couple of weeks back for writing all my own Save/Delete/Next etc buttons, so I have completely redone my main "Contacts" form using the button wizard. (I've also converted all the Macros to VBA so that I can more or less understand what they are actually doing!) Must admit this has cleaned things up a lot, but I have hit a problem ... as follows
There is an unbound "Find Contact" combo box on the form which lists...
|
by: TwoBit |
last post by:
Hello Bytes,
I am very new at using Microsoft Access and have just recently implicated it in recording productivity on outbound calls for my team.
My team is in charge of making outbound calls to agents to verify insurance on people's loans. We make a first call, and if it is not solved we will make a second call.
At the end of the day, we are required to send our totals in to workforce management to calculate the amount of calls we...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |