If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Popup Calendar
Using MS Office 2003 Pro
I am trying to add a popup calendar to a subform to enable users to select date vice typing it in a date field. I have done this on several forms, but cannot get it to work on the subform. I get "error msg 2110 MS ACCESS can't move the focus to the control DateCalendar " Here is code that works on forms: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) DateCalendar.Visible = True DateCalendar.SetFocus If Not IsNull(TransactionDate) Then DateCalendar.Value = TransactionDate.Value Else DateCalendar.Value = Date End If End Sub Is there a way to get this to work on the subform? Thanks |
#2
|
|||
|
|||
Popup Calendar
Hi, Shep.
If the TransactionDate text box resides on the main form and the DateCalendar calendar control resides on the subform, then find out the name of the subform control. This is _not_ the name of the subform, unless you've made the mistake of naming them the same. Whenever the main form is open, the subform _doesn't_ exist. It's being "held" by a special control on the form, the subform control, which must be referenced as a control before any of the controls residing on it can be referenced. Therefore, if the TransactionDate text box resides on the main form and the DateCalendar calendar control resides on the subform, then try: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Me!MyCtrl.Form.DateCalendar.Visible = True Me!MyCtrl.Form.DateCalendar.SetFocus If Not IsNull(Me!TransactionDate.Value) Then Me!MyCtrl.Form.DateCalendar.Value = Me!TransactionDate.Value Else Me!MyCtrl.Form.DateCalendar.Value = Date End If End Sub .. . . where MyCtrl is the name of the subform control. HTH. Gunny See http://www.QBuilt.com for all your database needs. See http://www.Access.QBuilt.com for Microsoft Access tips. (Please remove ZERO_SPAM from my reply E-mail address so that a message will be forwarded to me.) - - - If my answer has helped you, please sign in and answer yes to the question "Did this post answer your question?" at the bottom of the message, which adds your question and the answers to the database of answers. Remember that questions answered the quickest are often from those who have a history of rewarding the contributors who have taken the time to answer questions correctly. "shep" wrote: Using MS Office 2003 Pro I am trying to add a popup calendar to a subform to enable users to select date vice typing it in a date field. I have done this on several forms, but cannot get it to work on the subform. I get "error msg 2110 MS ACCESS can't move the focus to the control DateCalendar " Here is code that works on forms: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) DateCalendar.Visible = True DateCalendar.SetFocus If Not IsNull(TransactionDate) Then DateCalendar.Value = TransactionDate.Value Else DateCalendar.Value = Date End If End Sub Is there a way to get this to work on the subform? Thanks |
#3
|
|||
|
|||
Popup Calendar
Don't reinvent the wheel...I just asked this exact question three days ago
and got some great ideas, the best of which I felt could be found at and downloaded for free from http://allenbrowne.com/ser-51.html Allen's got a great Access site that is now in my favorites list. Good luck! "shep" wrote in message news Using MS Office 2003 Pro I am trying to add a popup calendar to a subform to enable users to select date vice typing it in a date field. I have done this on several forms, but cannot get it to work on the subform. I get "error msg 2110 MS ACCESS can't move the focus to the control DateCalendar " Here is code that works on forms: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) DateCalendar.Visible = True DateCalendar.SetFocus If Not IsNull(TransactionDate) Then DateCalendar.Value = TransactionDate.Value Else DateCalendar.Value = Date End If End Sub Is there a way to get this to work on the subform? Thanks |
#4
|
|||
|
|||
Popup Calendar
"'69 Camaro" wrote: Thanks for your response The date field and calerndar control are on the subform. Your explanation about the subform's status when the form is open may be why it is not setting focus of the calendar control. It may be that the setfocus function is controlled by the form. Hopefully there is a way to code it so the calendar will work on the subform. Thanks again for your help. Hi, Shep. If the TransactionDate text box resides on the main form and the DateCalendar calendar control resides on the subform, then find out the name of the subform control. This is _not_ the name of the subform, unless you've made the mistake of naming them the same. Whenever the main form is open, the subform _doesn't_ exist. It's being "held" by a special control on the form, the subform control, which must be referenced as a control before any of the controls residing on it can be referenced. Therefore, if the TransactionDate text box resides on the main form and the DateCalendar calendar control resides on the subform, then try: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Me!MyCtrl.Form.DateCalendar.Visible = True Me!MyCtrl.Form.DateCalendar.SetFocus If Not IsNull(Me!TransactionDate.Value) Then Me!MyCtrl.Form.DateCalendar.Value = Me!TransactionDate.Value Else Me!MyCtrl.Form.DateCalendar.Value = Date End If End Sub . . . where MyCtrl is the name of the subform control. HTH. Gunny See http://www.QBuilt.com for all your database needs. See http://www.Access.QBuilt.com for Microsoft Access tips. (Please remove ZERO_SPAM from my reply E-mail address so that a message will be forwarded to me.) - - - If my answer has helped you, please sign in and answer yes to the question "Did this post answer your question?" at the bottom of the message, which adds your question and the answers to the database of answers. Remember that questions answered the quickest are often from those who have a history of rewarding the contributors who have taken the time to answer questions correctly. "shep" wrote: Using MS Office 2003 Pro I am trying to add a popup calendar to a subform to enable users to select date vice typing it in a date field. I have done this on several forms, but cannot get it to work on the subform. I get "error msg 2110 MS ACCESS can't move the focus to the control DateCalendar " Here is code that works on forms: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) DateCalendar.Visible = True DateCalendar.SetFocus If Not IsNull(TransactionDate) Then DateCalendar.Value = TransactionDate.Value Else DateCalendar.Value = Date End If End Sub Is there a way to get this to work on the subform? Thanks |
#5
|
|||
|
|||
Popup Calendar
Did you get a popup calendar to work on a subform? If so, will you share the
code with me? Thanks "Darhl Thomason" wrote: Don't reinvent the wheel...I just asked this exact question three days ago and got some great ideas, the best of which I felt could be found at and downloaded for free from http://allenbrowne.com/ser-51.html Allen's got a great Access site that is now in my favorites list. Good luck! "shep" wrote in message news Using MS Office 2003 Pro I am trying to add a popup calendar to a subform to enable users to select date vice typing it in a date field. I have done this on several forms, but cannot get it to work on the subform. I get "error msg 2110 MS ACCESS can't move the focus to the control DateCalendar " Here is code that works on forms: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) DateCalendar.Visible = True DateCalendar.SetFocus If Not IsNull(TransactionDate) Then DateCalendar.Value = TransactionDate.Value Else DateCalendar.Value = Date End If End Sub Is there a way to get this to work on the subform? Thanks |
#6
|
|||
|
|||
Popup Calendar
Hi, Shep.
If both the date text box and the calendar control are on the subform, then your code should work, unless you wrote code elsewhere -- or changed the calendar control's property -- that interferes with this. Did you disable the calendar control? Check the DateCalendar's "Data" tab in the Properties dialog window. The Enabled Property should be set to Yes. If it is, then search through the code for the following: DateCalendar.Enabled = False The DateCalendar must be enabled when the focus is set to it. If you can't find where it's been disabled, then in your subform's module try: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) DateCalendar.Visible = True DateCalendar.Enabled = True DateCalendar.SetFocus If Not IsNull(TransactionDate) Then DateCalendar.Value = TransactionDate.Value Else DateCalendar.Value = Date End If End Sub HTH. Gunny See http://www.QBuilt.com for all your database needs. See http://www.Access.QBuilt.com for Microsoft Access tips. (Please remove ZERO_SPAM from my reply E-mail address so that a message will be forwarded to me.) - - - If my answer has helped you, please sign in and answer yes to the question "Did this post answer your question?" at the bottom of the message, which adds your question and the answers to the database of answers. Remember that questions answered the quickest are often from those who have a history of rewarding the contributors who have taken the time to answer questions correctly. "shep" wrote: Thanks for your response The date field and calerndar control are on the subform. Your explanation about the subform's status when the form is open may be why it is not setting focus of the calendar control. It may be that the setfocus function is controlled by the form. Hopefully there is a way to code it so the calendar will work on the subform. Thanks again for your help. "'69 Camaro" wrote: Hi, Shep. If the TransactionDate text box resides on the main form and the DateCalendar calendar control resides on the subform, then find out the name of the subform control. This is _not_ the name of the subform, unless you've made the mistake of naming them the same. Whenever the main form is open, the subform _doesn't_ exist. It's being "held" by a special control on the form, the subform control, which must be referenced as a control before any of the controls residing on it can be referenced. Therefore, if the TransactionDate text box resides on the main form and the DateCalendar calendar control resides on the subform, then try: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Me!MyCtrl.Form.DateCalendar.Visible = True Me!MyCtrl.Form.DateCalendar.SetFocus If Not IsNull(Me!TransactionDate.Value) Then Me!MyCtrl.Form.DateCalendar.Value = Me!TransactionDate.Value Else Me!MyCtrl.Form.DateCalendar.Value = Date End If End Sub . . . where MyCtrl is the name of the subform control. HTH. Gunny See http://www.QBuilt.com for all your database needs. See http://www.Access.QBuilt.com for Microsoft Access tips. (Please remove ZERO_SPAM from my reply E-mail address so that a message will be forwarded to me.) - - - If my answer has helped you, please sign in and answer yes to the question "Did this post answer your question?" at the bottom of the message, which adds your question and the answers to the database of answers. Remember that questions answered the quickest are often from those who have a history of rewarding the contributors who have taken the time to answer questions correctly. "shep" wrote: Using MS Office 2003 Pro I am trying to add a popup calendar to a subform to enable users to select date vice typing it in a date field. I have done this on several forms, but cannot get it to work on the subform. I get "error msg 2110 MS ACCESS can't move the focus to the control DateCalendar " Here is code that works on forms: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) DateCalendar.Visible = True DateCalendar.SetFocus If Not IsNull(TransactionDate) Then DateCalendar.Value = TransactionDate.Value Else DateCalendar.Value = Date End If End Sub Is there a way to get this to work on the subform? Thanks |
#7
|
|||
|
|||
Popup Calendar
Use my calendar at:
http://www.datastrat.com/Download/Calendar2K.zip Simply import the calendar for and the module into your database, and use the double-click event in any date field to place the following expression : =popCalendar() Works in forms, subforms and can be converted to every version of Access. -- Arvin Meyer, MCP, MVP Microsoft Access Free Access downloads http://www.datastrat.com http://www.mvps.org/access "shep" wrote in message ... Did you get a popup calendar to work on a subform? If so, will you share the code with me? Thanks "Darhl Thomason" wrote: Don't reinvent the wheel...I just asked this exact question three days ago and got some great ideas, the best of which I felt could be found at and downloaded for free from http://allenbrowne.com/ser-51.html Allen's got a great Access site that is now in my favorites list. Good luck! "shep" wrote in message news Using MS Office 2003 Pro I am trying to add a popup calendar to a subform to enable users to select date vice typing it in a date field. I have done this on several forms, but cannot get it to work on the subform. I get "error msg 2110 MS ACCESS can't move the focus to the control DateCalendar " Here is code that works on forms: Private Sub TransactionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) DateCalendar.Visible = True DateCalendar.SetFocus If Not IsNull(TransactionDate) Then DateCalendar.Value = TransactionDate.Value Else DateCalendar.Value = Date End If End Sub Is there a way to get this to work on the subform? Thanks |
#8
|
|||
|
|||
Popup Calendar
The calendar Darhl refers to works on any level of subform.
Just use the name of the text box in the Click event of the button, regardless of whether it is in a main form or a subform. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "shep" wrote in message ... Did you get a popup calendar to work on a subform? If so, will you share the code with me? Thanks "Darhl Thomason" wrote: Don't reinvent the wheel...I just asked this exact question three days ago and got some great ideas, the best of which I felt could be found at and downloaded for free from http://allenbrowne.com/ser-51.html Allen's got a great Access site that is now in my favorites list. Good luck! |
#9
|
|||
|
|||
Popup Calendar
Thanks for your response. I did get your calendar to work on forms, but on
this subform the icon did not show. I think I have a gremlin in this subform. Thank you "Allen Browne" wrote: The calendar Darhl refers to works on any level of subform. Just use the name of the text box in the Click event of the button, regardless of whether it is in a main form or a subform. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "shep" wrote in message ... Did you get a popup calendar to work on a subform? If so, will you share the code with me? Thanks "Darhl Thomason" wrote: Don't reinvent the wheel...I just asked this exact question three days ago and got some great ideas, the best of which I felt could be found at and downloaded for free from http://allenbrowne.com/ser-51.html Allen's got a great Access site that is now in my favorites list. Good luck! |
#10
|
|||
|
|||
Popup Calendar
I did get your calendar to work on a form, but on this subform the icon did
not show. I think I have a gremlin in this subform. More likely I have met the enemy and it is me. Thanks for your help. "Allen Browne" wrote: The calendar Darhl refers to works on any level of subform. Just use the name of the text box in the Click event of the button, regardless of whether it is in a main form or a subform. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "shep" wrote in message ... Did you get a popup calendar to work on a subform? If so, will you share the code with me? Thanks "Darhl Thomason" wrote: Don't reinvent the wheel...I just asked this exact question three days ago and got some great ideas, the best of which I felt could be found at and downloaded for free from http://allenbrowne.com/ser-51.html Allen's got a great Access site that is now in my favorites list. Good luck! |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Clearing my Calendar | Chaplain Doug | Calendar | 0 | August 22nd, 2005 04:21 PM |
Calendars in OL2003/OL2000 | Rich | General Discussion | 16 | February 10th, 2005 12:41 AM |
Group calendar stranegly loses appointments a while after theire m | Tim de Jager | Calendar | 1 | July 21st, 2004 04:51 PM |
Sync Outlook 2002 SP2 Personal Calendar with Exchange Calendar | Larry | Calendar | 0 | May 29th, 2004 12:06 AM |
Calendar and Public Exchange Folder | Markus Broy | Calendar | 2 | May 29th, 2004 12:01 AM |