CDROM-Guide forums  

PDA

View Full Version : Access: Data from a form to a table


   
psx4u
Aug 18, 2003, 04:23 AM
I am setting up a database and I have a table named "tbl_FullDetails" and I have a form named "frm_FullDetails".

On the form I have a "StartDate" field and another 6 dates that are review dates.
In the table i have created fields called StartDate and review1, review2 etc.

What I want to do is enter a start date in the form, then the review dates are automatically entered into the form.

I can do this no problem but I can't get the review dates to copy over into the table.

Any help would be gladly appreciated.

Thanks in advance.

Darkman
Aug 18, 2003, 11:20 PM
In the Form Properties set the 'Record Source' to the table ie tbl_FullDetails
Then in the text box properties for each of your date fields set the control source to the appropriate field in that table. When that form record loses focus, ie you move to the next record, then the values shown in the form fields will be written back to the date fields in the table.


Depending what's going on in your form you may need to refresh the form before causing a 'lost focus' to ensure the updated values are written to the table. For me the easiest way to do this is via a macro
Create a new macro
In the 'Action' field select 'RunCommand'
In the command box at the bottom of the screen select 'Refresh'
Save the macro.
On your form in the properties of the last text box to be updated go to the 'After Update' property and select the macro you've just written.
Then when this field is updated on your form it will automatically refresh the form - thus the data will be available for the form to write back to the table.

Let me know if you need more info

psx4u
Aug 19, 2003, 03:42 AM
Thanks for your reply Darkman.

That is how I had my form setup, however, I want the review dates to be automatically calculated within the form once a start date is entered. Once these dates have been calculated I would like them to be written to the table.

The way I thought about doing it was creating an update query with "=[StartDate]+84" to update the table and then have the form read from the table, however, with a table of around 500 records and each record needing 6 dates thats 3000 dates that need to be calculated and it could take some time, besides once the dates are calculated they wont need to change so having them calculated over and over would be unnecessary.

If you can understand my ramblings I would be grateful if you could come back with another solution.

Thanks again for your reply.

Darkman
Aug 20, 2003, 04:07 AM
psx4u

Check your :mail: