• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

VB Calendar help

I need to change the following code "Private Sub Calendar1_Click()"

If the following are all blank ""

txtrecieveddate
txtstarteddate
txtcompleteddate

I would like the calendar to intuitively place a date from the calendar click in the first textbox "txtrecieveddate"

The reason I cannot just use the tab stop is that on my spreadsheet there are other boxes, but I have removed these from this help file to avoid confusion.
help2.xls
0
Kiwi-123
Asked:
Kiwi-123
  • 3
  • 3
1 Solution
 
NorieCommented:
If you mean the date clicked in the calendar:
Private Sub Calendar1_Click()
 
  txtrecieveddate.Text = Format(Calendar1.Value, "dd/mm/yyyy")

End Sub

Open in new window


By the way, what is lastActiveDate in the code meant to be?
0
 
Kiwi-123Author Commented:
There are three textboxes, so if one is on setfocus then the calendar should input the date into that. However if the setfocus is outside any of the three and they all equal "", then the calendar would input into txtrecieveddate

I think the lastactivedate was supposed to lock the textboxes, this way the input had to be via the calendar and not entered manually.
0
 
NorieCommented:
When you click the calendar it will get focus and none of the texboxes will have focus.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Kiwi-123Author Commented:
This is the problem, I'd like the calendar to input into txtrecieveddate if:-


txtrecieveddate = ""
txtstarteddate = ""
txtcompleteddate = ""
0
 
NorieCommented:
Try this.
Private Sub Calendar1_Click()
  If txtrecieveddate.Text & txtstarteddate.Text & txtcompleteddate.text = "" Then
    txtrecieveddate.Text = Format(Calendar1.Value, "dd/mm/yyyy")
  End if
End Sub  

Open in new window

0
 
Kiwi-123Author Commented:
Thanks Again Imnorie!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now