Avatar billede kroning Nybegynder
14. april 2016 - 17:08 Der er 9 kommentarer og
1 løsning

Tabel i hukommelse der kan redigeres

Hej

Er det muligt at oprette en tabel i hukommelse, fylde den med data fra en anden tabel vhj. af en SQL og derefter redigere i denne nye tabel uden at data ændres andre steder end i hukommelsen.

Bruger Access 2007 og 2013
Avatar billede terry Ekspert
14. april 2016 - 18:28 #1
I've never had the need to create a table in memory so cant be sure if its possible or not.

You can create a recordset which is theoretically in memory and add/edit (I think) records.

May  ask why I needs to be in memory? Its only going to be available for the user at creates it, not other users. So you could just as well create a table and then drop it when work is complete.
Avatar billede kroning Nybegynder
14. april 2016 - 23:55 #2
What I need is to do a sql search in a table which is then displayed to the user. For each item there must be a checkbox which the user can check or uncheck, how do I get this checkbox shown? There is no field in the table that the checkbox can be bound to.
Here I thought I could use a temporary table.
Avatar billede terry Ekspert
15. april 2016 - 08:58 #3
Wouldn't it be easiest just to add a checkbox to the table?

I'm sure we can find another solution but not as easy having it in the table.
Avatar billede kroning Nybegynder
15. april 2016 - 09:54 #4
That would not work since there are multiple users, if they check and uncheck at the same time it would mess things up for each user

Is it not possible to build a temporary table and give it a random name and fill it with data using a SQL like

SELECT *, false AS checkbox FROM tblMyTable

That SQL works fine is I just run it but then I cant edit the checkbox field.

When the user is done with the table then I can delete it again.
Avatar billede terry Ekspert
15. april 2016 - 10:23 #5
Not knowing your full requirements its not easy to give the perfect solution. But I'm assuming you have a dB which allows all users to edit data in a table at the same time, and you want a way of allowing each user to edit the checkbox without interfering with other users.

You dont say if you have a front end and a back end set-up but if I assume that you do then it would be simple to create a temp table in the front end and copy required data into this. Then users could do whatever they wanted with it and delete when finished.

If you dont then whatever way you create objects which will allow users to edit the data is going to affect other users.
Avatar billede terry Ekspert
15. april 2016 - 10:25 #6
The "Back-End" database just contains the tables
The "Front-End" database contains the application objects (everything except the tables) and links to the tables in the back-end database

But it also allows you to create object in the front-end which will only be available for a single user.
Avatar billede kroning Nybegynder
17. april 2016 - 21:04 #7
I found this page on how to make in-memory recordset
http://www.databasejournal.com/features/msaccess/article.php/3846361/Create-In-Memory-ADO-Recordsets.htm

it works fine but I think I am going to use a temp table in the front-end database as you suggested, and then run a query like this:
SQL = "insert into rds_temp (firstname, lastname, email) " & _
          "Select firstname, lastname,email from employees where lastname like 'madsen'"

Smid en svar
Avatar billede terry Ekspert
18. april 2016 - 08:37 #8
for some reason I'm not able to see that link right now :-(

Good you found something you could use though
Avatar billede kroning Nybegynder
18. april 2016 - 16:14 #9
Drop an answer :-)
Avatar billede terry Ekspert
18. april 2016 - 16:58 #10
Oops :-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester