From: kay on 6 Nov 2009 13:59 I am beginner to ms access. I have created form and then insert a tab control (3 tabs) in a form. I am trying to write a vba code to add/update data into the table. I have created a table – ' Resources” which is currently blank. My fields are Name, EmpID, OriginalDt(Date when the first time item is entered), UpdateDt (Date of last update), UpdatedBy(Name of Emp who last update the item) The data entry into this table comes from Form (user will access this form. They don't have access to the table) So I have created above fields in a form. Now when user enters all above entries in a form and when they click on 'Update' button, these entries should go in Resources table. I tried using sample codes but not giving me appropriate result. Thanks
From: Jeff Boyce on 6 Nov 2009 14:05 If you "painted" controls on your form without "wiring" them to the underlying table (or better yet, to a query against that table), then Access isn't smart enough to know that you want what goes into those controls to "belong" to the table. Are your controls "bound"? Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or psuedocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "kay" <kay(a)discussions.microsoft.com> wrote in message news:83DF1CAD-E710-439A-8636-4DED57B5948C(a)microsoft.com... >I am beginner to ms access. > I have created form and then insert a tab control (3 tabs) in a form. > I am trying to write a vba code to add/update data into the table. > I have created a table - ' Resources" which is currently blank. > My fields are Name, EmpID, OriginalDt(Date when the first time item is > entered), UpdateDt (Date of last update), UpdatedBy(Name of Emp who last > update the item) > The data entry into this table comes from Form (user will access this > form. > They don't have access to the table) > So I have created above fields in a form. Now when user enters all above > entries in a form and when they click on 'Update' button, these entries > should go in Resources table. > > I tried using sample codes but not giving me appropriate result. > > Thanks >
From: kismert on 6 Nov 2009 15:20 You are working too hard. You want a "bound form" to do the work for you. You do this by binding the form to the table via a query: 1. Make a query, qryResources, which returns all the fields in table Resources, (Why? call it good practice) 2. In your form, set the Recordsource property to qryResources. 3. For each control in the form, set the Control Source to the appropriate field in the query. There! You now have a basic form that will read and write data to a table. Of course, there is a lot more twiddling you will want to do with the form properties to get something close to what you want, but I leave you with your perseverance and the trusty F1 key. -Ken
From: kay on 6 Nov 2009 16:07 Thanks, I tried this way but what happens that first time when the table was blank it worked fine. when you enter data in forms it goes to table but next time when you open the form it shows previous entries and that i do not want to show to user. they should not know what is there in the table. hope i am able to explain my point. "kismert" wrote: > You are working too hard. You want a "bound form" to do the work for you. > > You do this by binding the form to the table via a query: > 1. Make a query, qryResources, which returns all the fields in table > Resources, (Why? call it good practice) > 2. In your form, set the Recordsource property to qryResources. > 3. For each control in the form, set the Control Source to the appropriate > field in the query. > > There! You now have a basic form that will read and write data to a table. > > Of course, there is a lot more twiddling you will want to do with the form > properties to get something close to what you want, but I leave you with your > perseverance and the trusty F1 key. > > -Ken > >
From: Jeff Boyce on 6 Nov 2009 17:14
If the form is bound to the table (or, as I suggested previously, to a query against that table), then opening the form opens a window to the records in that table. If you want the form to ONLY all data entry (and not display existing records), you need to change the Data Entry property of the form. Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or psuedocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "kay" <kay(a)discussions.microsoft.com> wrote in message news:F5A47B07-D39D-41D0-B723-A5F54628749F(a)microsoft.com... > Thanks, > I tried this way but what happens that first time when the table was blank > it worked fine. when you enter data in forms it goes to table but next > time > when you open the form it shows previous entries and that i do not want to > show to user. > they should not know what is there in the table. > > hope i am able to explain my point. > > "kismert" wrote: > >> You are working too hard. You want a "bound form" to do the work for you. >> >> You do this by binding the form to the table via a query: >> 1. Make a query, qryResources, which returns all the fields in table >> Resources, (Why? call it good practice) >> 2. In your form, set the Recordsource property to qryResources. >> 3. For each control in the form, set the Control Source to the >> appropriate >> field in the query. >> >> There! You now have a basic form that will read and write data to a >> table. >> >> Of course, there is a lot more twiddling you will want to do with the >> form >> properties to get something close to what you want, but I leave you with >> your >> perseverance and the trusty F1 key. >> >> -Ken >> >> |