开发者

Queries based on forms and MS Access development

开发者 https://www.devze.com 2023-04-07 19:14 出处:网络
i have 2 questions when i use access: i create a form with comboBox andcalenders, i want to choose an employee

i have 2 questions when i use access:

  1. i create a form with comboBox and calenders, i want to choose an employee from combobox and from date and to date and when i click ok i will send these parameters to a query to return the result in a query (result is the calculation of it's salary).

  2. i know how to release an access project to be useful to user that can't access tables and queries only forms. is there any way to change the access project from release mode to development one, because supposed that an error occurred, how to solve it without loosing my data.

Note: i don't 开发者_开发问答have client/server i develop a program and i release it and give this release to the user, after a specific time this user tell me that an error occurred, and he need data inserted from this program to database. i can solve this problems and release another version of program, but the main problem is how to take all data from the old program to the new one.


-- You can reference form control in a query:

 SELECT FROM MyTable 
 WHERE EmployeeID = Forms!MyForm!cboEmployee
 AND SomeDate BETWEEN Forms!MyForm!txtDateStart And Forms!MyForm!txtDateEnd

You could also build an SQL string and use it as the record source for a form or in VBA.

-- Access should be split into front-end (forms, reports, etc) and back-end (data). When you make changes to the front-end, you create a new mde or accde and send that to the users. The data stays on a server in the back-end.

See: http://msdn.microsoft.com/en-us/library/aa167840(v=office.11).aspx

EDIT

From your comments, it seems that each application has a single user, if this is the case, splitting is not essential, but it can still be a good idea. The user will get two databases, one for data and one for forms etc and only the one for forms gets replaced. You will need to include a routine to locate and link the back-end tables.

However, if this is not possible, an mde or accde does not hide the data, you can send your revised copy and include a routine to import from the previous mde/accde.

EDIT 2

There are wizards that will split your database for you and link the tables. Where you find them varies slightly from version to version, but they are under the menu item Database Tools. The only problem with this is that the linked table holds the location for the back-end, which is on your computer, not on your users computer. Linked tables are how you access data in the second database. These act as if there are tables in the first database, except you cannot change them. Unfortunately, linked tables hold the location of the back-end, so this will have to be changed if you are sending it to a users. You can either write code, or show your user how to use the linked table manager. This may lead to confusion and may not be worth the effort for one PC. (See also http://www.alvechurchdata.co.uk/accsplit.htm)

Alternatively, you can split the database on your PC and make all the changes to forms etc that you want, then add some code that will import the tables and other data for the user into your new copy. The user will follow the instructions in your code to import the tables. As an aside, you will find that development is a lot safer on a split database. You should also decompile from time to time, which you can find at http://www.granite.ab.ca/access/decompile.htm.

If you want to protect your code, you can create a compiled version of this new copy, the extension for a compiled Access database is *.accde, for 2007 onward and *.mde for prior versions. This is what I thought you meant by 'i know how to release an access project'.

0

精彩评论

暂无评论...
验证码 换一张
取 消