473,416 Members | 1,570 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,416 software developers and data experts.

Passing dates from combo boxes populated by Calendar Control 10.0

Hi All,

I'm in the process of creating a database that allows users to enter details into a form which includes a date range as start and end dates.

I have used the inbuilt Calendar Control 10.0 control to allow users to select the date. It is linked to two combo boxes [cmbStartDate] and [cmbEndDate] using the following code (this code is repeated for each combo box):

Expand|Select|Wrap|Line Numbers
  1.  Private Sub cmbStartDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2.  
  3. Set cmbOriginator = cmbStartDate
  4.  
  5. ocxCalendar.Visible = True
  6. ocxCalendar.SetFocus
  7.  
  8.     If Not IsNull(cmbStartDate) Then
  9.  
  10.        ocxCalendar.Value = cmbStartDate.Value
  11.  
  12.     Else
  13.  
  14.        ocxCalendar.Value = Date
  15.  
  16.     End If
  17.  
  18. End Sub 
And..

[code] Private Sub ocxCalendar_Click()
''Update the ComboBox with the value entered into the ComboBox
''Put the value back into the relevant ComboBox
cmbOriginator.Value = ocxCalendar.Value

''Hide the calendar
cmbOriginator.SetFocus
ocxCalendar.Visible = False

''Clear the variable
Set cmbOriginator = Nothing

End Sub [\CODE]

This all seems to work fine- however, when I try to write the selected dates to a table or use them in a query they are not recognised (the form obviously needs to be open whilst the query runs), but if I manually type dates into these combo boxes these dates are picked up fine.

This is beginning to drive me mad so any help would be greatly appreciated.

Mark
Aug 23 '07 #1
2 2642
Hello All,

I've just re-read my post and I've missed out a vital piece of information: When the user has selected the relevant dates from the calendar control I am attempting to write the information to a table using an append query with [FORMS]![frmUpdate]![FieldName] syntax.

This works for all manually typed information from other fields on the form-but not for the VB-inserted dates from the control.

Does anyone know why?

Thank you
Aug 24 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
You need to pass the date values either to bound textboxes or to Public variables which will hold the values so they are available later.
Sep 1 '07 #3

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

Similar topics

3
by: Matthew | last post by:
I currently have a form in MS Access that has certain combo boxes which specify criteria in order to run a query based on that criteria. I want to add to this, a calendar from which a user will be...
14
by: Gary Shell | last post by:
I have five comboboxes each has a item listed populated by hand in the IDE. Each has the text property bound to a text field in the database. When I initially fill the dataset and display the page...
2
by: saloom | last post by:
Hi i created a calendar using the active xcontrols from the tools menu.I want the back color of the box containing the date to change based on the value of a field in the table at that specific...
2
by: visionstate | last post by:
Hi there, I am working on a form that uses 3 text boxes and 3 combo boxes. When any data is entered into any of these, I click a command button and this requeries a sub query in the form and...
7
by: evilcowstare via AccessMonster.com | last post by:
Hi, I have searched the forum for answers on this and to be honest as a novice I find it a bit confusing so apologies if it is simple. There are some searches that I want to apply to my database....
6
by: GaryGreenberg | last post by:
I am developing a web page for order processing using Spring MVC. In my JSP I have a table populated from the list of orders that are passed in the model (form backing object). Some fields there are...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
1
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a...
3
by: Mike P | last post by:
I am entering two dates into textboxes and using them as control parameters in an SQL DataSource which is being used to populate a gridview. I am using a custom validator to check if the data...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.