14. januar 2008 - 11:10Der er
22 kommentarer og 1 løsning
Hvordan kan jeg lave en requery, så data også opdaters i formular
Jeg har en master tabel og en detail tabel. Master tabellen har et felt, der består af sum(felt-fra-detail).
Jeg vil gerne vise den nye sum, når der er sket ændringer i detail formularen. Jeg har forsøgt at lave et felt (dummy) i detali formularfoden, som kunne holde summen. Men jeg får en fejl, fordi dummy'en kun vil accceptere me-rækken i detail.
Kan jeg lave en form for 'update master felt select sum()...)' eller hvad kan jeg gøre?
And you may need to include the "WHERE" parameter in the dsum if the detail records are related (which they very likeley will be) to the main form record
Concerning the comment you placed in you rother question ..
OrderID, sum(price pr. orderline), .....
When you have calculated fields in a query it will make the data read only.
You can get around this by having a field in the main table like you suggest here, or you could try having an unbound field on the main form an deither set this in code or maybe using th eexpression builder (right click in the Control source property and then choose build)
So if I have an unbound field in the main form how do I set the value in code? I have tried the expression builder but it doens't work. I have tried something like
Your updateing the master table so you have to use a field in the master table. The master and detail tables are related so it will be (normally) the primary key field in the main table.
..;"OrderID = " & [OrderID])
THis bit is the field from the detail form which I also assume has the saem name as the primary key in the main order table. & [OrderID])
You only need to close when your finished with the question, either when youhave received an anwer whichworks, or you find a solution yourself, or maybe when no answers have been helpeful. In this case you can just place an answer yourself and accpet it, then you get your points back.
Also if users have only placed a comment then you cant accept it, you need to get an anwer first. If your happy with any of the comments then you can get the user to place an answer, or again you can place on yourself to accept.
Yes, part of the problem is solved and then ... a new one ;-)
So now I can update, but it seems the update is only in the database, not on screen. Can I make a requery/refersh??? on the master formula from the after-update in the subformula?
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.