Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calendar popup on doubleclick

Status
Not open for further replies.

RBE

Programmer
May 25, 2000
72
US
Is it possible to copy the value of a control to clipboard and then paste it into another control using vba? What I am trying to do is create a "calendar on double click". I am using the activeX calendar. In the date field on my form I have the double click set up to bring up a popup of the calendar then I have the calendar set to copy the value after update and close but I am getting an error that says the copy cmd cannot be run right now and it tells me that I need to either convert the db (running 2000) or it is in a read only mode (sure it is!!). When I get back to the main form I have the date field set to paste the value of the calendar control (this is as of yet untested). Is there an easier way to do what I want without having to go through all this. Or can you tell me what is wrong with this code.

Private Sub
frmCalendar_AfterUpdate()
DoCmd.GoToControl "calendar"
DoCmd.RunCommand acCmdCopy
DoCmd.Close acForm, "frmCalendar"
End Sub


 
OK, after reading every listing in this board and every other I could find I came up with this code. It works great!! However, it only works for the one field. Is there any way I can make this work for other date fields in the database without having to reproduce the calendar for every one of the. I know enough to know it needs to be a public code and I need to assign variables for the [formname (a)]![formfield (b)] but from there I get a little foggy. Like if I did this where would the code get the names of the form and field and how would I tie it back to the public code back to the calendar popup?

Private Sub calendar_Click()
Forms![tenders form]![DATE RECEIVED] = Me![calendar]
DoCmd.Close acForm, "calendar"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top