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

Form doesn't save to Database

P: 5
Hi

I am relatively new to Access and I am coming to a pecuiliar problem. I've set a form with some text field with control source set to certain fields that inserts some data using textbox.value = dloolup(etc) during form_load. But when i close this form and move onto the next form, the textbox data isn't updated into the table. But if i go into datasheet view and update those fields manually and press ctrl-s the tables are updated.

Any suggestions or recommendations ?

Thanks, Dave
Dec 7 '06 #1
Share this Question
Share on Google+
5 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Can you post the form load code?

Mary

Hi

I am relatively new to Access and I am coming to a pecuiliar problem. I've set a form with some text field with control source set to certain fields that inserts some data using textbox.value = dloolup(etc) during form_load. But when i close this form and move onto the next form, the textbox data isn't updated into the table. But if i go into datasheet view and update those fields manually and press ctrl-s the tables are updated.

Any suggestions or recommendations ?

Thanks, Dave
Dec 7 '06 #2

P: 5
Expand|Select|Wrap|Line Numbers
  1.     Me.paddressText.value = DLookup("[paddress]", "12_mth_Phone_Participant1", "ID='" & [ID] & "'")
  2.     Me.phoneText.value = DLookup("[phone]", "12_mth_Phone_Participant1", "ID='" & [ID] & "'")
  3.     Me.pcityText.value = DLookup("[pcity]", "12_mth_Phone_Participant1", "ID='" & [ID] & "'")
  4.     Me.pstateText.value = DLookup("[pstate]", "12_mth_Phone_Participant1", "ID='" & [ID] & "'")
  5.     Me.pzipText.value = DLookup("[pzip]", "12_mth_Phone_Participant1", "ID='" & [ID] & "'")
  6.     Me.dateText.value = VBA.date
  7.     Me.AAText.value = [Forms]![00_1 Switchboard]![12AA]
  8.  
thanks,

the data loads correctly into the textbox. This problem also occurs if i change the textbox manually to something else.
Dec 7 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Expand|Select|Wrap|Line Numbers
  1.     Me.paddressText.value = DLookup("[paddress]", "12_mth_Phone_Participant1", "ID='" & [ID] & "'")
  2.     Me.phoneText.value = DLookup("[phone]", "12_mth_Phone_Participant1", "ID='" & [ID] & "'")
  3.     Me.pcityText.value = DLookup("[pcity]", "12_mth_Phone_Participant1", "ID='" & [ID] & "'")
  4.     Me.pstateText.value = DLookup("[pstate]", "12_mth_Phone_Participant1", "ID='" & [ID] & "'")
  5.     Me.pzipText.value = DLookup("[pzip]", "12_mth_Phone_Participant1", "ID='" & [ID] & "'")
  6.     Me.dateText.value = VBA.date
  7.     Me.AAText.value = [Forms]![00_1 Switchboard]![12AA]
  8.  
thanks,

the data loads correctly into the textbox. This problem also occurs if i change the textbox manually to something else.
Are you sure the form is bound to the relevant table and textbox controls all have their control source set to the relevant fields.
Dec 7 '06 #4

P: 5
Are you sure the form is bound to the relevant table and textbox controls all have their control source set to the relevant fields.
Yes, but i'll double check. But given that i updates correctly under datasheet view when i press ctrl-s, doesn't that suggest it is set correctly ?
Dec 7 '06 #5

MMcCarthy
Expert Mod 10K+
P: 14,534
Yes, but i'll double check. But given that i updates correctly under datasheet view when i press ctrl-s, doesn't that suggest it is set correctly ?
It does but there is no reason for it to update in one view and not in the other. Of course there is always the unmentionable corruption issue. Hopefully that's not the problem.

Check the form properties as well. Make sure allow additions and allow deletions are set to Yes.

BTW, in the form load how are you setting the value of the ID field. I know you said the textboxes were filling correctly but it's strange that the data is not updating.

The only other thing I can think of; is there any code in the forms unload event or have you got a save button on the form that is being clicked in form view but not available in datasheet view. If so what is the code behind that button.

Mary
Dec 7 '06 #6

Post your reply

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