Avatar billede ed Nybegynder
06. juli 2001 - 11:35 Der er 10 kommentarer og
1 løsning

Bevar værdi

Her er sikkert nogle lette point:

En ordredatabase vil typisk indeholde mange poster fordelt på få sælgere. Jeg vil derfor gerne have et lille afkrydsningsfelt i formularen som brugeren kan afkrydse så den næste nye post automatisk har sælgerens navn forudfyldt.

Hvordan gør jeg dette?

\"ed
Avatar billede terry Ekspert
06. juli 2001 - 11:46 #1
Not shure I understand your question!

If the user checks a checkbox, you want the current \"sælgere\" to be placed in the next created records, is that correct?

Add a checkbox to the form and a hidden field to hold the sælger navn.


On after update event

Me.fldhidden = Me.sælgere \'Move the current to hidden

On before update event place your code something like this.

If cbChecked then
Me.sælgere = Me.hidden
end if

or something like that...
Avatar billede probelmos Nybegynder
06. juli 2001 - 11:49 #2
Ømmm...*

/Michael
Avatar billede terry Ekspert
06. juli 2001 - 11:50 #3
The hidden field is just to hold the last enetered sales rep. This gets updated every time an after update event is triggered, it could also be blank if your dB allowes it!

Then the before update event checks to see if you want to use the last sales rep. name, if so move it to the field and this is the table field and not the text field.
Avatar billede terry Ekspert
06. juli 2001 - 11:54 #4
Har du problemer med at forstå det jeg skriv Michael?
Avatar billede terry Ekspert
06. juli 2001 - 12:15 #5
Better change If cbChecked  to If cbChecked = True...
Avatar billede ed Nybegynder
06. juli 2001 - 13:54 #6
I can follow your reasoning terry, and it seems you pretty much understand what I want to do. And there is no problem in writing to the hidden field, that part works a charm. But now I have to get the syntax for the second leg right.

Basically, a user types in a name in the namefield, checks a box by the name, and the next record created will have the same name in the namefield. So it\'s a new, blank record except for one field carried over from the previous record.

I\'ve tried the If ... then option, but that only gives me a runtime error. A strategically inserted msgbox confirms that the value contained in the hidden field is the correct one, but it won\'t allow me to create a new record with it.

Does that make slightly more sense? Figured I\'d give my English a go seeing as that seems to be your preferred style :^)

\"ed
Avatar billede terry Ekspert
06. juli 2001 - 16:05 #7
send your database to dkTeBrsa@europe.lego.com
an I will take a look!
Avatar billede terry Ekspert
06. juli 2001 - 16:06 #8
that is lego.com
Avatar billede terry Ekspert
07. juli 2001 - 16:45 #9
I have another suggestion. The first idea had its flaws!
I suggest that you have a combo box containing all sales reps. names and also a check box. Then if the user selects a sales rep. and also checks the combo, then all NEW records will get this name.

In the Before Insert event place code similar to this.

If cbChecked = True then
  me.sælgere = Me.cboAllSalesReps
end if

Change the field name accordingly

I would also set the tab stop field for the sales rep to NO, as this gets entered automatically.

Avatar billede ed Nybegynder
09. juli 2001 - 13:05 #10
Thanks a lot for your help Terry!
Avatar billede terry Ekspert
09. juli 2001 - 13:19 #11
Thanks for the extra points, hope it works, if not then get back to me!

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