473,395 Members | 1,535 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.

DTPicker: Problem getting user input to a text field

4
Hi, everyone

I'm building an Access DB system using VBA. I have a ActiveX DTPicker so the user can select a date. This date is put in another textbox that is bound to a table. I do this because if I make the DTPicker bound to the table then the date keeps changing to the current date (or the date that was last selected) when I scroll through the records on the form. I just made the DTPicker so small that only the dropdown arrow is visible and put it right next to the bound textbox. The event that I use in DTPicker to write the value to the textbox is "On Lost Focus" like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub DTPicker9_LostFocus()
  2.     Dim pos As Integer
  3.     pos = InStr(DTPicker9.Value, " ")
  4.     Me.txtbox = Left(DTPicker9.Value, pos)
  5. End Sub
This works fine but I want the textbox to show the new date as soon as the user selects it, not when the DTPicker looses focus. I don't know how to do it because DTPicker only has these events; On updated, On Enter, On Exit, On Got Focus and On Lost Focus. It seems to me I will need somthing like On Change event.

I've really been pulling my hair over this so hopfully someone has a solution to this problem.
Mar 2 '07 #1
8 8318
willakawill
1,646 1GB
Hi. What happens if you use the onupdated event?
Mar 2 '07 #2
vijaydiwakar
579 512MB
Hi, everyone

I'm building an Access DB system using VBA. I have a ActiveX DTPicker so the user can select a date. This date is put in another textbox that is bound to a table. I do this because if I make the DTPicker bound to the table then the date keeps changing to the current date (or the date that was last selected) when I scroll through the records on the form. I just made the DTPicker so small that only the dropdown arrow is visible and put it right next to the bound textbox. The event that I use in DTPicker to write the value to the textbox is "On Lost Focus" like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub DTPicker9_LostFocus()
  2.     Dim pos As Integer
  3.     pos = InStr(DTPicker9.Value, " ")
  4.     Me.txtbox = Left(DTPicker9.Value, pos)
  5. End Sub
This works fine but I want the textbox to show the new date as soon as the user selects it, not when the DTPicker looses focus. I don't know how to do it because DTPicker only has these events; On updated, On Enter, On Exit, On Got Focus and On Lost Focus. It seems to me I will need somthing like On Change event.

I've really been pulling my hair over this so hopfully someone has a solution to this problem.
I've not get thy problem well but i think u may try textbox's gotfocus event as
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Text1_GotFocus()
  3. Text1 = dtp.Value
  4. End Sub
  5.  
  6.  
Mar 3 '07 #3
Sid666
4
Hi. What happens if you use the onupdated event?
Hi. Yes, I had tried the On updated event but it didn't work.
Mar 5 '07 #4
Sid666
4
I've not get thy problem well but i think u may try textbox's gotfocus event as
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Text1_GotFocus()
  3. Text1 = dtp.Value
  4. End Sub
  5.  
  6.  
I'm not better off using the OnGotFocus event of the textbox because the DTPicker gets the focus first when the user selects the date. Then the textbox gets the focus and the date appears in the textbox (because I use the OnLostFocus event of the DTPicker). I will try to explain my problem better: I want the date to appear in the textbox the same time the user selects (clicks on) the date in the DTPicker so the user can see instantly the date in the textbox not when the DTPicker looses focus.
I'm just concerned about that if the user-click has no response (i.e. no date appears in the textbox) that will be confusing to the user.

Hope you get my point... any other ideas?
Mar 5 '07 #5
vijaydiwakar
579 512MB
I'm not better off using the OnGotFocus event of the textbox because the DTPicker gets the focus first when the user selects the date. Then the textbox gets the focus and the date appears in the textbox (because I use the OnLostFocus event of the DTPicker). I will try to explain my problem better: I want the date to appear in the textbox the same time the user selects (clicks on) the date in the DTPicker so the user can see instantly the date in the textbox not when the DTPicker looses focus.
I'm just concerned about that if the user-click has no response (i.e. no date appears in the textbox) that will be confusing to the user.

Hope you get my point... any other ideas?
I don't no whether i get it or not if yes then try this code
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub DTPicker1_Change()
  3. Text1.Text = DTPicker1.Value
  4. End Sub
  5.  
  6.  
  7. Private Sub DTPicker1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  8. Text1.Text = DTPicker1.Value
  9. End Sub
  10.  
  11.  
Mar 5 '07 #6
Sid666
4
I don't no whether i get it or not if yes then try this code
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub DTPicker1_Change()
  3. Text1.Text = DTPicker1.Value
  4. End Sub
  5.  
  6.  
  7. Private Sub DTPicker1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  8. Text1.Text = DTPicker1.Value
  9. End Sub
  10.  
  11.  
Like I said in the first post, DTPicker only has the following events: On Updated, On Enter, On Exit, On Got Focus and On Lost Focus. So I don't know how I can use the subs you suggest (Change and MouseUp). Should I implement them myself, and if so what would be the triggering event?
Mar 5 '07 #7
vijaydiwakar
579 512MB
Like I said in the first post, DTPicker only has the following events: On Updated, On Enter, On Exit, On Got Focus and On Lost Focus. So I don't know how I can use the subs you suggest (Change and MouseUp). Should I implement them myself, and if so what would be the triggering event?
No dear the code i've given is tested by me. I had droped ctrl from mswindows comman ctrl
Mar 6 '07 #8
Like I said in the first post, DTPicker only has the following events: On Updated, On Enter, On Exit, On Got Focus and On Lost Focus. So I don't know how I can use the subs you suggest (Change and MouseUp). Should I implement them myself, and if so what would be the triggering event?
You may have solved this already since March, but after struggling with the same problem, I noticed that on switching to the VBA code editor for the form conaining my Date Time Picker control, and selecting my DTPicker0 control in the top left-hand dropdown box,
in the right-hand drop-down box there are many more events listed than are shown in the MS Access Property Box; One of them is "Change"....

That created a subroutine

Private Sub DTPicker0_Change()
unbound_ctrl_Date = DTPicker0.Value
End Sub

Which updates my unbound control whenever I select a date.
Which I think is what you wanted to do.
Jun 6 '07 #9

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

Similar topics

12
by: Adam Lipscombe | last post by:
Folks, I need to get the contents of a form attribute. In Read/Write mode this is field, so I can use getElementById("name").value In ReadOnly this is just plain text, so I can use...
3
by: dei3cmix | last post by:
Hey, I am having a problem with a program I am working on. Basically, the first part of the program gets input from a file using cin.getline. Then the second part, (still in the same main as the...
11
by: Killer42 | last post by:
Hi all. Short version: DtPicker goes strange when .Enabled changed in VBA code, looking for solution or good workaround. Looooong version: Those of you who have been following various threads...
5
by: Robi | last post by:
I have a form which has a dtPicker control with a checkbox. The user checks or unchecks the box to indicate whether or not the date should be utilized. My problem is that the user would prefer to...
2
by: blees10 | last post by:
Hey Guys, I have an issue with a dtpicker field in one of my forms. I developed this form using Access 2003 and everything works fine. Recently, I've been asked to deploy this database to...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
21
vikas251074
by: vikas251074 | last post by:
I am getting error while entry in userid field. When user enter his user id, an event is fired immediately and user id is verified using AJAX method. But I am getting error 'Object doesn't support...
1
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
9
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.