Avatar billede region Nybegynder
20. december 2001 - 11:05 Der er 11 kommentarer og
1 løsning

Reset formular

Jeg har en formular hvor der er 5 combobokse.
disse 5 combobokse refererer til hver deres forespørgsel. eks.:
query 1 er baseret på en hovedtabel.
query 2 er baseret på query 1
query 3 er baseret på query 2

nu ønsker jeg at nulstille alle mine queryes med en VBA kommando via en knap. JEg har prøvet med :
combo1.value = \"\"
osv. og også
docmd.showallrecords
docmd.requery
docmd.repaint

men lige lidt hjælper det. Det virker såfremt jeg lukker og ånber formen men dette er dog lidt omsonst..

what do i do...!!!!
Avatar billede terry Ekspert
20. december 2001 - 11:10 #1
Nulstille? Do you want to empty the combo boxes?

Me.theCombo.Requery will run the query again if that is whatyou want!
Avatar billede region Nybegynder
20. december 2001 - 12:16 #2
Hmmm....

Virker ikke helt efter hensigten. når jeg kører flg. kan jeg ikke vælge noget i komboen efterflg.

Solar_Group_System.Value = \"\"
Product_Line.Value = \"\"
Product_Sector.Value = \"\"
Product_Group.Value = \"\"
Item_Group.Value = \"\"
Famely_name.Value = \"\"

Solar_Group_System.Requery
Product_Line.Requery
Product_Sector.Requery
Product_Group.Requery
Item_Group.Requery
Famely_name.Requery


NB :

Disse navne er navnet på min komboboks
Avatar billede terry Ekspert
20. december 2001 - 13:07 #3
I need to know what you wnat to do? (nulstil) means somthing in th eregion of Empty, is that what you want? If so then you need to alter the combo\'s row source to sometyhing which returns NO values.
Avatar billede region Nybegynder
21. december 2001 - 09:17 #4
Når jeg kører mit script \"sætter\" jeg værdierne i de respektive kombobokse til \"null\". Men de forespørgsler der har et kriterie der er afhængig af værdierne i disse kombobokse bliver ligesom hængende med de værdier man havde valgt inden jeg satte comboerne til \"null\".

Det jeg ønsker er altså at resette mine queryes uden at skulle lukke og genåbne min form.

giver det mening??
Avatar billede terry Ekspert
21. december 2001 - 10:16 #5
When you say \"sætter\" kombobokse to \"null\" do you mean that you empty the text field part of the combo box, the list part still contains data deosnt it?

You say \"Nulstile\" your queries. Are your queries made dynamically? (when you choose values form the  combo\'s you build the query) Or do they just refer to the combo boxes?

If you build the queries dynamically then you need to build them again when the combo boxes (entry field) are emptied.
Otherwise I would have thought that Me.requery after null stilling the text boxes would work.

Try  NOT using theCombo.value = \"\" but Me.theCombo = \"\"





Avatar billede region Nybegynder
21. december 2001 - 10:29 #6
  When you say \"sætter\" kombobokse to \"null\" do you mean that you empty the text field part of the combo box, the list part still contains data deosnt it? :

yes. Text is being emty, list value still exist.
I want to emty this list value also.



You say \"Nulstile\" your queries. Are your queries made dynamically? (when you choose values form the  combo\'s you build the query) Or do they just refer to the combo boxes? :

the just refer to the combo. Eg :in the criteria field of query1 the criteria is as follows.:

[Forms]![F_classifikation]![Solar Group System]



About your last comment.:

I will try to set the followings in the script to see if that works :



Private Sub Command145_Click()
Me.Solar_Group_System.Value = \"\"
Me.Product_Line.Value = \"\"
Me.Product_Sector.Value = \"\"
Me.Product_Group.Value = \"\"
Me.Item_Group.Value = \"\"
Me.Famely_name.Value = \"\"
Me.Requery
End Sub

get back in a moment.!!!!
Avatar billede region Nybegynder
21. december 2001 - 10:34 #7
The list of value from the recent choice is not disapearing.... shit også...!!!!!

It is the me.requery that i think is the problem... it wont \"set\" the queryes to \"null\" in the criteria i guess... ( the previus list of choice is not being \"reset\")
Avatar billede terry Ekspert
21. december 2001 - 10:45 #8
If you want to empty the list values, then you have to alter the RowSource and RowSourceType.

This is taken from Access help, but emptying may give problems, why do you wnat to empty it?

The following example sets the RowSourceType property for a combo box to Table/Query, and it sets the RowSource property to a query named EmployeeList.

Forms!Employees!cmboNames.RowSourceType = \"Table/Query\"
Forms!Employees!cmboNames.RowSource = \"EmployeeList\"

If your queries refer to the combo boxes then its more than likley because the combo (entry) still contains data.

Use Me.YourCbo = \"\" to emty the combo\'s


Avatar billede terry Ekspert
21. december 2001 - 10:55 #9
Me.YourCombo.Rowsource = \"\"
Avatar billede region Nybegynder
02. januar 2002 - 16:04 #10
Hej terry...

Godt nytår....!!!!

Nå, Me.YourCombo.Rowsource = \"\" er ikke en god løsning da denne resetter min kilde fr min comboboks. Grunden til jeg vil resette denne er såfremt man kommer ti at lave et forkert valg i en boks skal man starte forfra igen og det kan man kun vet at lukke og åbne formularen.
Avatar billede region Nybegynder
04. januar 2002 - 11:03 #11
?
Avatar billede terry Ekspert
04. januar 2002 - 21:50 #12
hi region!
and a good New Year to you too!

Been to England for the New Year, just got back today.
Dont know what to suggest then, sorry!
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