One idea would be to have a table which is used for holding your temporary data and when the user presses the "Fakturer" button copy the data to your permanent tables.
Another idea would be write the data to the tables as normal and if th user chooses to NOT press the "Fakturer" button delete the newly entered data.
If your tables are related and you have set cascade deletes to on then deleting the record in t_faktura wouldalso delete the detail records in t_fakturalinier.
Well it maybe is in other programming languages but I'm not sure if its possible in Access.
You have to remember that the form where you enter your data is normally bound to a table so will get written to the table as you enter the data. Working with unbound fields on forms is also possible but not as easy, so in fact you could enter the data into the unbound fields and then copy the data to the tables when the user press the button. But this approach would require more programming.
Det kom aldrig til at virke. i fakturalinie delen, kunne access kun håndtere fem linjer eller frem records.
Tanken omkring transaktioner er god og i teorien skulle det virke fantastisk, men ikke via ADO...
Og det er endda testet i access 2000.
Løsningen bliver at hoved faktura formularen ikke bindes til nogen tabel ( for at undgå at brugeren kan trykke pagedown og oprette mere end een faktura af gangen.
Faktura linjerne må blive oprettet i en tmp. tabel og så kopieret til de virkelige data når der trykkes på [fakturer].
Ps. hint omkring hvordan der pænt og nemt kopieres via recordset modtages gerne.
I find i strange that Microsoft suggest using transactions and you can only manage with around five records.
I think working with a TEMP table for the detail lines is a good choice.
You can copy the records from the TEMP table in a query which you can run when the user presses a button to accept.
The query will look something like this as long as the field names are the same.
INSERT INTO tblDetail SELECT * FROM tblTemp
If they arent then you will need to give the names in the query
INSERT INTO tblDetail (destinationFieldsGoHere) SELECT sourceFieldsGoHere FROM tblTemp
And you may have to do this if you use an autonumber field as you primary key.
And you can also have a DELETE query to delete the TEMP records after they are copied to the right table.
DELETE * FROM tblTEMP.
To copy the header record you could also have an append query which took the values from the form.
Synes godt om
Ny brugerNybegynder
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.