At prøve at sætte focus på feltet er ikke en mulighed da det helt sikkert IKKE eksisterer på rapporten, men muligvis er i feltlisten. Jeg tildeler ControlSource til en række kontroller på rapportens Ved-Åbning hændelse, men jeg kan kun tildele dem som findes i feltlisten derfor er jeg nødt til at kontrollere at det er i feltlisten før jeg tildeler det som ControlSource til min kontrol.
I can guess that the reason you want to do this is because you dont know what the name of the field name is? (Problem http://www.eksperten.dk/spm/485314) In my opinion you should stop up a bit and try and find a CORRECT solution to the previos question first and then this question would not be necessary!
IS it possible to give the field in the query a name? You also have (had) another question on how to create a query in code, I am sure that you could do it there, or by creating the query incode and giving it a column name at the same time.
I you dont know the name then you obvioulsy dont know if it is in the field list. So how are you go to check if the field exists if you dont know what name it has?
Jeg kender for så vidt godt feltnavnene. De bliver genereret i min krydstabulering og er en række datoer i en 14-dages periode. På rapportens Ved-Åbning hændelse aflæser jeg så startdatoen i den formular hvorfra jeg kalder rapporten og tildeler herefter navne med følgende kode: Dim d d = Forms!frm_Lønperioder!txt_First d1.ControlSource = d + 1 d2.ControlSource = d + 2 d3.ControlSource = d + 3 d4.ControlSource = d + 4 d5.ControlSource = d + 5 d8.ControlSource = d + 8 d9.ControlSource = d + 9 d10.ControlSource = d + 10 d11.ControlSource = d + 11 d12.ControlSource = d + 12
Problemet opstår hvis der ikke er poster på en dato for så bliver den ikke oprettet i krydstabuleringen og dermed eksisterer feltnavnet ikke i rapporten og jeg får fejl når jeg efterfølgende forsøger at tildele det som ControlSource.
d = Forms!frm_Lønperioder!txt_First d1.ControlSource = d + 1 d2.ControlSource = d + 2 d3.ControlSource = d + 3 d4.ControlSource = d + 4 d5.ControlSource = d + 5 d8.ControlSource = d + 8 d9.ControlSource = d + 9 d10.ControlSource = d + 10 d11.ControlSource = d + 11 d12.ControlSource = d + 12
stry>The comment you gave 04/04-2004 18:18:26 says "Jeg KAN ikke tildele kolonnerne navne i en krydstabuleringsforespørgsel" MY COMMENT 04/04-2004 18:14:14 is asking you to use On ERROR RESUME NEXT in your code! Have you tried this?
so in fact what you are saying is that YOUR CODE example you gave 04/04-2004 18:06:10 doesnt work! If thats doesnt work then using On Error.. isnt gong to help much! If your field name is [29-03-2004], can you use this directly in the controlSource property? If you ca NOT use a field name [29-03-2004] directly in the property then you will not be able to set it in code either!
have you switch your error handling off? In code view open the Tools Options window and the select the General Tab. Make sure thatthe Break on Unhandled errors is checked and NOT Break On All Errors!
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.