Hi,
I have 15 images in a userform. The (Name) is Image1, Image2, Image3.....Image15.
Every image belongs to a textbox. The boxes are called: txtControleDatum1, txtControleDatum2, txtControleDatum3.......txtControleDatum15
When I click on 1 of the images a calender pops up. The goal is that when I click on image3, the date must be filled in txtControleDatum3.
The calender is on one form and the images and textboxes are on another form. I called them frmKalender and frmControlesToezicht.
I was thinking of the following solution which unfortunately doesn't work.
In my form frmControlesToezicht I add the following code (I declared KalenderButton as integer) - I show only the first 4 but it goes up to 15.
on the Kalender form (frmKalender) I am using this code to test if the output is correct.
When I'm clicking on image 1 the result is: Kalenderbutton is: 0
When I'm clicking for the second time on image 1, the result is: Kalenderbutton is: 1
And after that when i'm clicking again and again on image1, the result is: Kalenderbutton is: 1
Next step is clicking on image2
The first time the result is: Kalenderbutton is: 1
The 2nd, 3rd, 4th.... time the result is: Kalenderbutton is: 2
and the same pattern goes on with image 3, 4 .....
The pattern I discovered is that when I'm clicking for the first time on an image, it starts with 0. Clicking for the 2nd, 3rd time etc. gives the correct result.
When I'm clicking on another image it starts the first time with the same number as the one I clicked before. And not only in the order 1, 2 , 3.
If I click the first time on image 3 it starts with 0 followed by 3,
If I click on a second button - for example button 1 - it starts with 3 followed by 1.
What am I doing wrong? What do I not see? Or what is a better approach?
I have 15 images in a userform. The (Name) is Image1, Image2, Image3.....Image15.
Every image belongs to a textbox. The boxes are called: txtControleDatum1, txtControleDatum2, txtControleDatum3.......txtControleDatum15
When I click on 1 of the images a calender pops up. The goal is that when I click on image3, the date must be filled in txtControleDatum3.
The calender is on one form and the images and textboxes are on another form. I called them frmKalender and frmControlesToezicht.
I was thinking of the following solution which unfortunately doesn't work.
In my form frmControlesToezicht I add the following code (I declared KalenderButton as integer) - I show only the first 4 but it goes up to 15.
VBA Code:
Private Sub Image1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
frmKalender.Show
KalenderButton = 1
End Sub
Private Sub Image2_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
frmKalender.Show
KalenderButton = 2
End Sub
Private Sub Image3_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
frmKalender.Show
KalenderButton = 3
End Sub
Private Sub Image4_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
frmKalender.Show
KalenderButton = 4
End Sub
on the Kalender form (frmKalender) I am using this code to test if the output is correct.
VBA Code:
Private Sub btnBevestigDatum_Click()
MsgBox "Kalenderbutton is: " & frmControlesToezicht.KalenderButton
Unload Me
When I'm clicking on image 1 the result is: Kalenderbutton is: 0
When I'm clicking for the second time on image 1, the result is: Kalenderbutton is: 1
And after that when i'm clicking again and again on image1, the result is: Kalenderbutton is: 1
Next step is clicking on image2
The first time the result is: Kalenderbutton is: 1
The 2nd, 3rd, 4th.... time the result is: Kalenderbutton is: 2
and the same pattern goes on with image 3, 4 .....
The pattern I discovered is that when I'm clicking for the first time on an image, it starts with 0. Clicking for the 2nd, 3rd time etc. gives the correct result.
When I'm clicking on another image it starts the first time with the same number as the one I clicked before. And not only in the order 1, 2 , 3.
If I click the first time on image 3 it starts with 0 followed by 3,
If I click on a second button - for example button 1 - it starts with 3 followed by 1.
What am I doing wrong? What do I not see? Or what is a better approach?