Avatar billede rickie Juniormester
28. juni 2007 - 11:53 Der er 8 kommentarer og
1 løsning

Sendkeys til en form og et felt

Hej,

Har en kalender hvor man kan ska välge dato. Hvordan sender jeg det til en form og et specifikt felt?
Har en "ok" og en "Avbryt" knap.

Jeg har fundet nedenstående men ved ikke hvordan jeg får det at virke.
---
Private Sub cmdOk_Click()
    On Error Resume Next
    Me.Visible = False
    If varType(Screen.ActiveControl.Value) = vbDate Then
        Screen.ActiveControl = Me.Kalender
    Else
        SendKeys Me.Kalender
    End If
    DoCmd.Close acForm, Me.Name
End Sub
Avatar billede terry Ekspert
28. juni 2007 - 19:43 #1
The way I normally use the calendar is to have a global (public variable) which is used to hold the selected date.

For each field which is used for entering dates I either use the double click event in the field or have a button beside the field which opens the form with the calendar control on it.

In the calendar form I put the chosen date into the global variable. Then when I return to the code which opens the calendar form I can now take the global variable and put it in the appropriate field.
Avatar billede rickie Juniormester
29. juni 2007 - 08:22 #2
Sounds smart but can you show me an example. Im dum and i don´t know how to make a global variable or get it to work.
Avatar billede terry Ekspert
29. juni 2007 - 17:16 #3
you have my email in the other question, I will make an example if you send me your dB
Avatar billede terry Ekspert
29. juni 2007 - 17:21 #4
and dont forget http://www.eksperten.dk/spm/763429  :o)
Avatar billede rickie Juniormester
29. juni 2007 - 19:13 #5
He he! The points are yours :-)
I will send you the DB. Please confirm that you reciev it!

Look at the form 'frmBrevbokning', there is a button between the field "Förfallodag" wich opens 'frmKalender'. I want to be able to select a date, and then send it to any form. In 'frmKalender' there is a button "Ok" (+ Avbryt/Cancel) and i want it to send the date back to 'frmBrevbokning' BUT i also want to have a third button in 'frmKalender' and when i click that button i want it to open another form, that i havent made yet, and send it to a field in that form. Is this possible?
Avatar billede terry Ekspert
29. juni 2007 - 21:09 #6
Why do you want to be able to open another form from the calendar form and send it to a field on that form? Yes its possible but doesnt sound logical.
Avatar billede rickie Juniormester
30. juni 2007 - 08:38 #7
The thing is that i need that to 1: Just send the value back to the form where i clicked the button. 2: When i have clicked the button and the frmKalender is open i would like a third button in frmKalender that will send it to a new form, this new form will be a reminder form where the user can type a text and then be reminded that specific date.
Avatar billede terry Ekspert
03. juli 2007 - 15:34 #8
better place an answer here too :o)
Avatar billede rickie Juniormester
03. juli 2007 - 18:20 #9
Thx :-)
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