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
6 1927
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?
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? - calStartDate.Value = "1/1/2008"
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
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!
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: - Set Rs1 = Db.OpenRecordset("tblAccountDeliveryDays")
-
Rs1.MoveFirst
-
-
Do While Not Rs1.EOF
-
If Rs1("Account number") = intAccountNumber Then
-
Exit Do
-
End If
-
Rs1.MoveNext
-
Loop
-
chkMonday = Rs1("Monday")
-
chkTuesday = Rs1("Tuesday")
-
chkWednesday = Rs1("Wednesday")
-
chkThursday = Rs1("Thursday")
-
chkFriday = Rs1("Friday")
-
chkSaturday = Rs1("Saturday")
-
chkSunday = Rs1("Sunday")
-
txtSpecialNotes = Rs1("Special Notes")
-
cmbDeliveryQuadrant = Rs1("Delivery Quadrant")
-
calStartDate.Value = Rs1("Start Date")
-
-
Rs1.Close
-
Db.Close
So I think it has more to do with the actual object, but like I said problem solved.
thanks,
Lobster
Sign in to post your reply or Sign up for a free account.
Similar topics
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)...
|
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...
|
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...
|
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...
|
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.
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
| |