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

Data not save to table

P: 14
Hi, I have a form which contains 2 fields: Minutes and Hours.
User enter the minutes then it automatically convert the minutes in term of hour.

If I set the control source of field "Hours" to =[Minutes]/60, the data will not be saved. If I set the Control Source of field "Hours" to "Hours", the data are save to the table.

How could I solve the proble.

I would appreciate for any help. Michelle
Dec 11 '06 #1
Share this Question
Share on Google+
9 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Hi, I have a form which contains 2 fields: Minutes and Hours.
User enter the minutes then it automatically convert the minutes in term of hour.

If I set the control source of field "Hours" to =[Minutes]/60, the data will not be saved. If I set the Control Source of field "Hours" to "Hours", the data are save to the table.

How could I solve the proble.

I would appreciate for any help. Michelle
Michelle

For adding new records the default value of the control being set to =[Minutes]/60 should solve your problem.

Otherwise you could put the following code in the After Update event of Minutes as follows:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Minutes_AfterUpdate()
  3.  
  4.    Me.Hours = Me.Minutes / 60
  5.  
  6. End Sub
  7.  
  8.  
Mary
Dec 11 '06 #2

NeoPa
Expert Mod 15k+
P: 31,616
Hi, I have a form which contains 2 fields: Minutes and Hours.
User enter the minutes then it automatically convert the minutes in term of hour.

If I set the control source of field "Hours" to =[Minutes]/60, the data will not be saved. If I set the Control Source of field "Hours" to "Hours", the data are save to the table.

How could I solve the proble.

I would appreciate for any help. Michelle
Bind the control (Set the Control Source to Hours) then in the AfterUpdate event of the Minutes control add some code :
Expand|Select|Wrap|Line Numbers
  1. Me.Hours = Me.Minutes/60
Dec 11 '06 #3

NeoPa
Expert Mod 15k+
P: 31,616
Setting the Default value is probably easier :).
I'm off to bed (She keeps beating me to the post and sometimes they're even better answers :().
Dec 11 '06 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
Bind the control (Set the Control Source to Hours) then in the AfterUpdate event of the Minutes control add some code :
Expand|Select|Wrap|Line Numbers
  1. Me.Hours = Me.Minutes/60
Too late Ade.

I got there before you.

Notice how I'm making nonsense posts. :D

Mary
Dec 11 '06 #5

NeoPa
Expert Mod 15k+
P: 31,616
Too late Ade.

I got there before you.

Notice how I'm making nonsense posts. :D

Mary
At 02:30 I didn't even notice the obvious :(.
Lol -Ade.
Dec 11 '06 #6

P: 14
It works except that "Me.Hours = Me.Minutes / 60" doesn't give the correct hour.
If I have 66 minutes, it only gives me 1 hour. But with [Minutes]/60, I get 1.1 hour

Michelle
Dec 11 '06 #7

NeoPa
Expert Mod 15k+
P: 31,616
It works except that "Me.Hours = Me.Minutes / 60" doesn't give the correct hour.
If I have 66 minutes, it only gives me 1 hour. But with [Minutes]/60, I get 1.1 hour

Michelle
I'm not sure which you're saying is the good one.
But if setting the Default value works - look no further.
Dec 11 '06 #8

MMcCarthy
Expert Mod 10K+
P: 14,534
I'm not sure which you're saying is the good one.
But if setting the Default value works - look no further.
Hi Ade

Sorted in separate post. Just had to change the number format of hours.

BTW Michelle,

Sorry I said data type instead of format in the other thread. Glad you got it sorted.

Mary
Dec 11 '06 #9

NeoPa
Expert Mod 15k+
P: 31,616
Thanks Mary,

I saw the other post but didn't have time to 'moderate' it.
nvm - all sorted now.

Cheers -Ade.
Dec 12 '06 #10

Post your reply

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