Question : Best practice; Front end Access 2007 Application, updating Back end SQL 2005 DB

I'm new to programming and want to start on the right foot.  I'm setting up an Access 2007 front end forms/functionality and using a SQL 2005 DB for the data.  What is the best practice for working with the data within the DB?

One way I know of is to simply code the changes into the VB that is passed through a connection to the DB, but the user would need to have modify rights to the DB.  

I would like only the application to have modify rights, not the user, to prevent the unlikely event the user makes a direct connection to the DB and figures out how to screw the data.  Any insight you can provide is greatly appreciated!

Answer : Best practice; Front end Access 2007 Application, updating Back end SQL 2005 DB

One solution to your question is the create and ADODB connection with the SQLServer as a procedure in a module.  In that connection string set the user as a Server based log in withe the appropriate permissions.  

Then, fore each record entry or modification, you write the SQL insert or update statements and then execute them with an ado command.  you'll need to have an execute/save button on each form to trigger this.    

pretty strait forward for new records. The forms would all be 'stateless', i.e. every control would be unbound.   Once the data was entered, the values in the fields would be gathered into the insert statement.

For changes though, it can be a real chore to create a procedure to check if any given field has been changed and if so build it into a update statement.  The other option is to write the update statement to change every field of the record to whatever value is inthe corrisponding field of the form, regardless if it is changed or not.  

The other trick to changes is showing the existing data or record.  I've done this by having the form based on a pass through query that I change in the form_open event to point to a spacific record.  

I can give you specific code examples if this approach makes sense.
Random Solutions  
 
programming4us programming4us