Avatar billede n_riber Nybegynder
14. maj 2001 - 11:55 Der er 7 kommentarer og
1 løsning

Jeg er på herrens mark

Jeg skal have access til at sammenligne 2 poster i en formular, når følgende betingelser er opfyldt:
feltet [batchnr] er identisk, feltet [dato] er identisk.

det der skal sammenlignes er feltet [vand].
hvis access finder at differencen er >0,4 skal feltet[difference] være = * ellers = null

/Niels
Avatar billede terry Ekspert
14. maj 2001 - 12:05 #1
can you give a bit more information?
When you say \"2 poster\" do you mean that there are two records in the detail, and if that is correct can there be more than the two records?

You can send me your dB an I can take a look

Terry
Avatar billede n_riber Nybegynder
14. maj 2001 - 12:28 #2
i want to compare 2 records in a form;
if [batchnr] and [date] are identical in both records, access is to compare the fields [vand] and if the difference is >0.4 the field [difference] = * else = null

/niels
Avatar billede terry Ekspert
14. maj 2001 - 12:37 #3
n_riber, I think your problem is more complicated than the 30 points suggests.
If I understand you correctly there are a number of records on the form. Each record has to be compared to the others and if another has the same [batchnr] and [dato] then you want to set the [difference]field to * otherwise null.

So from this I can assume that there can be more than two records where these fields are the same, is this not correct?



Avatar billede n_riber Nybegynder
14. maj 2001 - 12:59 #4
the records are ONLY to be compared if they havethe same [batchnr] AND same[date].
then if the difference between record1.[vand] and record2.[vand] is larger than 0.4 record2.[difference]= * otherwise= null.

each day there is 2 records with the same [batchnr].
Avatar billede n_riber Nybegynder
14. maj 2001 - 13:00 #5
havethe = have the
Avatar billede terry Ekspert
14. maj 2001 - 13:35 #6
I assume that the [difference] field is also a field in the table. If so then I suggest that you run an update query to set the [difference] field in the table to either \"*\" or null, when you open the form. If the field isnt bound to the table then you could set it by using the iif() and the dcount() functions. the iif is like an IF and the dcount will return the number of records where your criteria is true.  IE if Dcount > 1 then difference = * else null. The synax may take a bit of playing around with but for 30 points hope this gives you an idea...


Avatar billede n_riber Nybegynder
14. maj 2001 - 14:41 #7
Hi Terry,

I have absolutely no idea what you mean.
but i have solved this wit a dlookup function

Niels
Avatar billede terry Ekspert
14. maj 2001 - 14:43 #8
Hi Niels
Is it my English you dont understand or the answer?

But then if you have solved the problem then you get the points!

Terry
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