473,471 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Selecting & adding records

1 New Member
I'm developing a database in access 2003 that will allow users to select several records via a toggle button on a continuous form and then hit a button on the same form that opens a query that appends the selected records to another table. The problem is that all the selected records get appended to the table accept for the one that has focus. I have to hit the button again to get all of the selected records.I also have all of the warnings turned off. I'm not quite sure if that makes a difference.What is the best way around this problem.
Nov 28 '11 #1
6 2066
NeoPa
32,556 Recognized Expert Moderator MVP
Although your question is not very well formed, it does appear that your confusion is related to Why Values in Unbound Form Controls do not Persist. If that helps then fine, otherwise you'll need to explain your situation properly before requesting help.
Nov 28 '11 #2
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
My guess is that the last record you clicked on (The one in focus) is still DIRTY(I.e, the change is not saved.) A quick fix to this, is to add to your code a forced save:
Expand|Select|Wrap|Line Numbers
  1. Me.Dirty=False
This should go in the code for you button, before you run your query to transfer records.

I hope this is what you need, otherwise you need to try to explain your situation and setup better (toggle button bound or unbound for instance) as well as any code used.
Nov 28 '11 #3
NeoPa
32,556 Recognized Expert Moderator MVP
You're probably right there Smiley. I misread "The problem is that all the selected records get appended to the table accept for the one that has focus." as "... all the records ...".

This indicates the control is almost certainly bound, as it would have to be for this to work at all.
Nov 28 '11 #4
Mihail
759 Contributor
Hello !

I don't know how work DIRTY command.
If you set DIRTY to false that automatically save (update) the record(s) ?

Just another idea is to place this code
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCommand acCmdSaveRecord
under On Click event of your toggle button.

SCmajor !
I have a perplexity.
I understand that the toggle button is linked to a Yes/No field.
Saying you select 300 records (turn the Yes/No field to Yes) you will need another 300 clicks to deselect this records, isn't it ?
How you handle that ?
Nov 29 '11 #5
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
@Mihail

Setting Me.Dirty=False will cause the record to be saved. As far as I know it is equivalent to DoCmd.RunCommand acCmdSaveRecord, but I am not 100% sure if they are exactly identical. I personally prefer and always use the first method.

Instead of clicking 300 times, I assume he runs an update query setting the value of the field to false.
Nov 29 '11 #6
NeoPa
32,556 Recognized Expert Moderator MVP
Very interesting point Smiley. For the record, I believe the two commands are synonymous, but I can't be 100% sure.

Personally, I prefer the latter method as it is very clear about what the code is doing. The former is an approach I don't believe should even be there. It's counter-intuitive and can lead to confusions. That's just my personal opinion of course. Not agreeing with me should not be considered wrong - just a different approach.
Nov 29 '11 #7

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

Similar topics

4
by: webhigh | last post by:
I¹m not sure if this a PHP question or an MySQL question but here it goes. I have a repeat region of a table called userid What I¹m trying to accomplish is being able to edit the record and...
6
by: Jamie Fryatt | last post by:
Hi everyone, here's what id like to do. I have a table with 2 fields, name and value I need to be able to add multiple records quickly, for example I need to add name value abc 1...
4
by: Manish Sawjiani | last post by:
Hi Experts, I am just into dot net and i want simple code for adding records into Access table (97) using oledb. There are no queries in the databases and there is only one table: Friends with...
8
by: k | last post by:
Hi all I split a database in a table-part and a all-the-rest-part and linked the tables, but my code adding records to a table crashes on Set rs = db.OpenRecordset("tblDeltakelse",...
0
by: brijeshmathew | last post by:
Hi I use Visual Basic 6, Service Pack 6, Microsoft ActiveX Data Objects 2.8 Library(msado15.dll) and access 2000 database using JET 4 OLE. I have an application that adds records simultaneously...
1
by: Nkagi | last post by:
Hi All, I have a problem of adding records into table, if the cursor is on the first record the record that I add replaces the first record and then I moved it to the last record and the new...
0
by: Mustang97 | last post by:
I've created a custom datagrid with a custom ado connection. Everything works perfectly except now I am trying to add a button that will add records. The way I know how to do that is with the...
1
by: Vjys | last post by:
Hello, I need help... I am inserting records into MS access by recordset.AddNew function, it is adding records at end if im going on adding. If i delete some records by calling recordset.delete...
1
by: Kristilee | last post by:
I am working with an attendance database that holds records for each employee for when they are absent. For every 30 days WORKED for each employee I need to have the database automatically add a...
13
by: angi35 | last post by:
Hi - working in Access 2000... my goal is to combine fields from two tables in a query: Table 1 has ItemNumber and ItemDescription. There's only one record per ItemNumber. Table 2 has ItemAlias....
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
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
tracyyun
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...
0
agi2029
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,...
1
isladogs
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.