473,395 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

problem with calender object

Hey everyone,
I'm having trouble manipulating the calender object in vba. I have a form with a Microsoft calender control object 9.0 embedded in it. All I want to do is upon opening this form, set the date to the value I pull from a table. This field I pull from is a date field formated "mm/dd/yyyy" here is the code in question:

calStartDate.Value = Rs1("Start Date")

when hovering over each of these values while in break mode (I know not the right terminology) I get "1/1/2007" for calstartdate.value and "1/27/2007" for Rs1("Start Date") but upon stepping to the next line the value of calStartDate.value doesn't change at all. Starting to get real frustrating. Anybody have any idea why this is happening?
thanks,
Lobster
Jan 5 '07 #1
6 1927
nico5038
3,080 Expert 2GB
I prefer to use the minicalendar control from http://www.mvps.org/access/forms/frm0050.htm
(Excellent site with much info and samples)

Idea ?

Nic;o)
Jan 6 '07 #2
missinglinq
3,532 Expert 2GB
It would probably help if we could see your code. What exactly is this Rs1("Start Date") you're trying to assign to the calendar?
Jan 6 '07 #3
willakawill
1,646 1GB
Hey everyone,
I'm having trouble manipulating the calender object in vba. I have a form with a Microsoft calender control object 9.0 embedded in it. All I want to do is upon opening this form, set the date to the value I pull from a table. This field I pull from is a date field formated "mm/dd/yyyy" here is the code in question:

calStartDate.Value = Rs1("Start Date")

when hovering over each of these values while in break mode (I know not the right terminology) I get "1/1/2007" for calstartdate.value and "1/27/2007" for Rs1("Start Date") but upon stepping to the next line the value of calStartDate.value doesn't change at all. Starting to get real frustrating. Anybody have any idea why this is happening?
thanks,
Lobster
Hi what happens if you replace the recordset value with a literal?
Expand|Select|Wrap|Line Numbers
  1. calStartDate.Value = "1/1/2008"
Jan 6 '07 #4
MSeda
159 Expert 100+
Your'e problem seemed pretty straight foward so I built a test form as you described and I found this. the code did not function in the on open event as you stated. so I moved it to the On Load event. It worked! I've been told the on load event occurs after on open. perhaps some of the experts can give a more in depth description of the differences between the two.

Hope this helps,
Megan
Jan 7 '07 #5
missinglinq
3,532 Expert 2GB
The sequence of events when initializing a form is (per Access Help)


Open [font=Symbol]Þ[/font] Load [font=Symbol]Þ[/font] Resize [font=Symbol]Þ[/font] Activate [font=Symbol]Þ[/font] Current


I believe I've read somewhere that the Open event is the actual initializing of the physical framework, if you will, of the form, while the Load event is the actual "loading" of the Record Source, assuming the form is bound. If this is correct, it would explain why the code fails during the Open event but works during the Load event, when the Record Source has been loaded. I never use the OnOpen event, so never even gave that any thought!


Good catch, Megan!
Jan 7 '07 #6
Thanks everyone,
I moved it over to the on load event and that fixed it. My guess is the calender object was not fully initialized or something to that effect until after the on open event. The form was not bond to any recordset, but rather Rs1 was a recordset I created in code:
Expand|Select|Wrap|Line Numbers
  1.     Set Rs1 = Db.OpenRecordset("tblAccountDeliveryDays")
  2.     Rs1.MoveFirst
  3.  
  4.     Do While Not Rs1.EOF
  5.         If Rs1("Account number") = intAccountNumber Then
  6.             Exit Do
  7.         End If
  8.         Rs1.MoveNext
  9.     Loop
  10.     chkMonday = Rs1("Monday")
  11.     chkTuesday = Rs1("Tuesday")
  12.     chkWednesday = Rs1("Wednesday")
  13.     chkThursday = Rs1("Thursday")
  14.     chkFriday = Rs1("Friday")
  15.     chkSaturday = Rs1("Saturday")
  16.     chkSunday = Rs1("Sunday")
  17.     txtSpecialNotes = Rs1("Special Notes")
  18.     cmbDeliveryQuadrant = Rs1("Delivery Quadrant")
  19.     calStartDate.Value = Rs1("Start Date")
  20.  
  21.     Rs1.Close
  22.     Db.Close
So I think it has more to do with the actual object, but like I said problem solved.
thanks,
Lobster
Jan 7 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: francois | last post by:
hi, I have an ASP.NET application with a piece of code that looks like this: (it is a VB.NET snippet) Thread.CurrentThread.CurrentCulture = New CultureInfo(Session.Item("Culture").ToString)...
2
by: David B | last post by:
I have a text box on a form header into which a date is entered to filter the data in the continuous form. A requery in after update does the trick. If I populate the text box from a calender form...
4
by: Chris | last post by:
Hi, I am trying to create a popup calender so a user can click on a button on the main form, a calender will then popup, the user will select a date and then click ok on the popup. The date will...
5
by: MasterChief | last post by:
I have a imagebutton that when you click on it, it will open up a page containing a calender. When the pages starts up it gives the error Object reference not set to an instance of an object. and...
0
by: Steven Blair | last post by:
Hi, I would like to create a Calender effect like this website: http://www.expedia.co.uk/default.aspx This site uses ASP.NET, so I guess we should be able to use VS 2005 to recreate this. ...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
7
by: gubbachchi | last post by:
Hi all, In my application I need to display the data fetched from mysql database after the user selects date from javascript calender. I have written the code in which after the user selects the...
21
Vkas
by: Vkas | last post by:
i had created my own web calender control!!!! it consist 1} text box (it display's the selected date) 2} button (it hide and show the calender control) 3} calender control (use for the selection...
1
by: xtremebass | last post by:
Hello Bytes, i have a calender program which is created by using Javascript. when i execute that program using Internet Explorer,it works properly but when i tried in Mozilla firefox it didnt...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.