By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,140 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Problem with Databound textboxes

100+
P: 126
Hello everyone,

I created an Access VBA form, which contains a date textbox and a calendar image. The textbox is bounded to "Date" field of "UserProfile" Table.

Whenever a user clicks the calendar image, a popup calendar will be opened and the user can choose date to enter it in the focused textbox.

But, I want to enter the chosen date in all the bounded date textboxes present in the form instead of only in the focused textbox.

Please kindly let me know how to solve this issue.

Thanks in advance.
Nov 12 '08 #1
Share this Question
Share on Google+
5 Replies


P: 68
Hi

How about using the 'on updated' event of the calendar control? i.e.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Calendar_Updated(Code As Integer)
  2. text box 1 = me.calendar
  3. text box 2 = me.calendar
  4. 'and so on, using the correct names for your controls
  5. End Sub
Kevin
Nov 12 '08 #2

FishVal
Expert 2.5K+
P: 2,653
Hello.

Take look at Forms Interaction howto.

Regards,
Fish
Nov 12 '08 #3

missinglinq
Expert 2.5K+
P: 3,532
I think we need to clarify one point before we get off on the wrong tangent here! Is Kevin correct in assuming that by

I want to enter the chosen date in all the bounded date textboxes present in the form instead of only in the focused textbox.
you mean that you have a number of different textboxes in the current ***record*** all of which you want to set to this selected date?

Or do you mean that you want the selected date to populate the same textbox on all of the records in your form?

Linq ;0)<
Nov 13 '08 #4

100+
P: 126
Hello missinglinq,

Thanks for the reply.

I want the selected date to populate in the same textbox on all of the records in my form.

Please let me know how to solve this issue.

Thanks a million.
Nov 13 '08 #5

P: 90
Expand|Select|Wrap|Line Numbers
  1. DoCmd.SetWarnings False
  2. Dim SQL As String
  3. SQL = "UPDATE userProfile" & _
  4.           "SET userProfile.Date= '" & me.calendar & "'
  5. 'MsgBox SQL
  6. DoCmd.RunSQL SQL
  7. DoCmd.SetWarnings True
In theory that should update all instances of the 'Date' field from the table 'UserProfile' to the value selected on the selected forms calendar control (named 'calendar').
The MsgBox is a debug thing I do; comment out the RunSQL line and uncomment MsgBox to get a popup box containing the SQL.
PLEASE copy or backup the table before running this as I haven't tested it, I've just copied and modified.
Also if you need it to be only certain ones add a WHERE at the end.

Oh, and comment out the first line "SetWarnings False", and you'll get a message saying how many records will be updated and asking if you want to continue. It's a good idea to do this to make sure you're getting the number you think you should be.
Nov 14 '08 #6

Post your reply

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