0% found this document useful (0 votes)
72 views16 pages

Desktop and Server Databases: I Ntroduction To Data I Mport/ Export

The document provides instructions for importing and exporting data between Microsoft Access and other databases or applications. It discusses importing Microsoft Access objects, splitting a Microsoft Access database to separate the back-end database on a server from the front-end databases on user computers, creating an ACCDE file to prevent users from modifying form and report designs, and linking Microsoft Access databases to Microsoft SQL Server databases.

Uploaded by

HRTOC
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views16 pages

Desktop and Server Databases: I Ntroduction To Data I Mport/ Export

The document provides instructions for importing and exporting data between Microsoft Access and other databases or applications. It discusses importing Microsoft Access objects, splitting a Microsoft Access database to separate the back-end database on a server from the front-end databases on user computers, creating an ACCDE file to prevent users from modifying form and report designs, and linking Microsoft Access databases to Microsoft SQL Server databases.

Uploaded by

HRTOC
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Desktop and Server Databases

I ntr oduction to D ata I m por t/ Expor t


I ntr oduction
I m port ing dat a allows you t o get infor m at ion fr om an ext er nal source and insert it in your dat abase. Micr osoft Access can accept dat a fr om various applicat ions, and w it h a lit t le t rick, you can im port even fr om unfr iendly applicat ions. Before im por t ing dat a, you m ust m ake sure t hat it is in a form at Microsoft Access can read; even if t hat dat a is com ing from anot her applicat ion of t he Microsoft Office suit e.

To im port a file or obj ect s, on t he Ribbon, you can click t he Ext ernal Dat a t ab. I n t he I m port sect ion of t he Ribbon, click t he but t on t hat cor responds t o t he t ype of obj ect you w ant t o get . What happens depends on t he t ype of file you are t rying t o im port . Expor t ing a Microsoft Access obj ect consist s of saving a t able in a form at t hat an applicat ion ot her t han Micr osoft Access can use. Because t his depends on t he ext er nal applicat ion, we w ill review differ ent issues as w e m ove on.

I m por ting M icr osoft Access Objects


Micr osoft Access obj ect s are probably t he easiest obj ect s t o im port because, cr eat ed wit h t he sam e applicat ion, t hese obj ect s are already form at t ed and r ecognizable. You can im por t obj ect s of a Micr osoft Access t ype of any version. To im port obj ect s fr om anot her Microsoft Access dat abase, on t he Ribbon, you can click t he Ext er nal Dat a t ab. I n t he I m por t sect ion of t he

Ribbon, click t he Access but t on . This would open t he Get Ext er nal Dat a - Access Dat abase wizard. You should first locat e t he folder t hat cont ains t he dat abase, and t hen select t he dat abase.

Pr actical Lear ning: I m por ting a M icr osoft Access Object


1. St art Micr osoft Access and open t he Clar ksville I ce Cream 1 dat abase you creat ed in Lesson 2

2. On t he ribbon, click Ext ernal Dat a. I n t he I m por t sect ion, click Access 3. I n t he fir st page of t he Get Ext ernal Dat a - Access Dat abase w izar d, click Br owse 4. Locat e t he folder t hat cont ains t he resour ces for t hese lessons and select it 5. I n t he list of files, click Clarksville I ce Cream .m db and click Open 6. On t he wizard, click OK 7. I n t he Tables proper t y page of t he I m port Obj ect s dialog box, click Select All

8. Click OK 9. On t he dialog box, click Close

Splitting a D atabase
Most of t he dat abases w e w ill creat e in our lessons are referr ed t o as deskt op dat abases because t hey are m eant t o be inst alled in t he com put er w her e t hey will be used. For m aint enance pur poses, t he pr oblem wit h t his appr oach is t hat , if you dist ribut e your dat abase t o t he users or if you have dist ribut ed t he dat abase t o a few people already, if you m odify t he dat abase, you w ill have t o visit each one's com put er t o inst all a new version of t he dat abase or t o m odify t he dat abase on each user's com put er. For exam ple, im agine t hat som e or all users of t he dat abase call you and say t hat a cert ain for m or r eport seem s t o produce a wr ong result and you suspect t hat an expr ession in t he dat abase is false. Once you find out w hat needs t o be done t o correct t he pr oblem , you would have t o visit each com put er t o m ake t he change. Also, if you want t o backup t he dat abase, alt hough you need only t he values st ored in t he t ables, you m ay have t o visit each com put er. Som et im es t his is not possible and it is unpr ofessional. Micr osoft Access provides an alt ernat ive t o t his pr oblem . You can divide your dat abase in t wo part s. One par t would be inst alled on one com put er t hat can be a server or j ust anot her com put er. This is r eferr ed t o as back - end. The ot her par t would be inst alled in each user's com put er. These users com put er can t hen connect t o t he back - end dat abase t hat st ores t he act ual dat abase. The user s com put er have only t he graphical int er face t hat allows t hem t o w ork. I f you m odify t he dat abase ( for exam ple if you corr ect an expression t hat w as pr oducing w rong r esult s) , you can do it on t he back - end dat abase and t he user s' com put ers w ould r eceive t he change. To im plem ent t his scenar io, you split your dat abase. To split a dat abase, on t he Ribbon, you can click Dat abase Tools. I n t he Move Dat a sect ion, you

can click t he Access Dat abase but t on ( if you receive a Microsoft Office Access Secur it y Not ice, read it and click Open) . This w ould open t he Dat abase Split t er dialog box wit h four paragr aphs and t wo but t ons. Aft er r eading t hem , you can click Split Dat abase. This w ould open t he Creat e Back - End Dat abase dialog box. I t w ould suggest a nam e of a dat abase t hat is m ade of t he or iginal nam e of t he dat abase followed by _be. You can keep t hat nam e or change it . Once you are ready, you can click Split . The split t ing pr ocess w ould st art . When t he split t ing is over , you will r eceive a m essage box and you can click OK. Aft er split t ing a dat abase, t he t ables w ould be r em oved from t he Navigat ion Pane. The linking t ables w ould have new icons and each icon w ould appear wit h an arrow t hat indicat es t hat t he t able is only linked t o an act ual t able in t he back - end dat abase. Also, aft er split t ing a dat abase, since t he act ual t ables would have been rem oved from t he Navigat ion Pane, you cannot m odify t heir st r uct ure from a user 's com put er. That is, you cannot add a colum n or change t he dat a t ype of a field. Aft er split t ing t he dat abase, you can inst all t he _be file, t hat was cr eat ed when split t ing, t o t he server or t he com put er t hat will host it . Then inst all t he or iginal dat abase on t he user 's com put ers. You should ( m ust ) t hen est ablish a connect ion bet ween each user's com put er and t he back - end server .

Pr actical Lear ning: Splitting a D atabase


1. Fr om t he r esources t hat accom pany t hese lessons, open t he Bet hesda Car Rent al2 dat abase. Not ice t he obj ect s in t he Navigat ion Pane

2. On t he Ribbon, click Dat abase Tools

3. I n t he Move Dat a sect ion, click Access Dat abase

4. You receive a Dat abase Split t er dialog box. Read t he paragr aphs and click Split Dat abase 5. I n t he Creat e Back - End Dat abase dialog box, change t he nam e of t he file t o bcr 5 and click Split . When t he split t ing is over, a dialog box appear s

6. Read it and click OK 7. Open t he bcr 5 dat abase. Not ice t he icons of t he t ables in t he Navigat ion Pane and t he absence of t he for m s

8. Re- open t he Bet hesda Car Rent al5 dat abase and not ice t he new icons of t he t ables in t he Navigat ion Pane

9. I n t he Cars sect ion, r ight - click Car s and click Design View 10. You receive a m essage box. Read it and click No ( if you open one of t he form s, cr eat e a new r ecor d, and open t he bcr 5 dat abase, you w ill not ice t hat t he new record you creat ed exist s)

ACCD E Files
I f you have cr eat ed a dat abase and decide t o dist r ibut e it or t o give it t o a cust om er , colleagues or em ployees, t hey m ay be t em pt ed t o open t he form s in Design View and possibly m odify t heir st ruct ures. There are t w o disadvant ages t o such an act ion. They m ay com prom ise or corr upt your hard w ork, possibly rendering it obsolet e. Som e bad eye m ay decide t o cheat on your VBA code. Microsoft Access allows you t o m ake som e or m ost of t hese act ions difficult or im possible. An ACCDE file is a dat abase com piled by Micr osoft Access so t he user s of t he dat abase cannot change t he design of form s or r eport s, cr eat e new form s or r eport s, view it s VBA code, or im port form s, repor t s or VBA code. Before cr eat ing an ACCDE file, you should enable t he securit y. To do t his, on t he Message Bar, you can click Opt ions... I n t he Microsoft Office Securit y Opt ions dialog box, click t he Enable This Cont ent radio but t on and click OK. To creat e an ACCDE file of your dat abase, aft er opening it , on t he Ribbon, you can click Dat abase Tools. I n t he Dat abase Tools sect ion, you can click Make ACCDE. You w ill receive t he Save As dialog box wit h a suggest ed file. You can accept t hat file nam e or r eplace it . Aft er t his, you can click Save.

M icr osoft Access and M icr osoft SQL Ser ver


I ntr oduction
I f you have a Microsoft SQL Ser ver dat abase and you w ant t o use it in a Microsoft Access dat abase, you have various opt ions. You can im port t he obj ect s from t he server dat abase or you can creat e a Microsoft Access pr oj ect t hat is a dat abase whose t ables link t o t he server.

I m por ting M icr osoft SQL Ser ver Tables


I f you have reason you server , you dat abase in one or m ore t ables t hat are part of a Microsoft SQL Ser ver dat abase but for som e do not w ant , do not need, or ar e not allowed, t o w ork dir ect ly on t he dat abase can im port t he obj ect s t o Micr osoft Access. You first need t o creat e t he r ecipient Microsoft Access.

Micr osoft Access t r eat s Micr osoft SQL Ser ver as one of t he ODBC fam ily of dat abases ( t he Micr osoft Windows operat ing syst em has a driver t hat allow s different dat abase environm ent s t o com m unicat e or int eract wit h t he sam e dat abase, as long as t hey follow som e rules of t he ODBC driver; for exam ple, an applicat ion cr eat ed w it h Delphi and a PHP w eb sit e bot h can com m unicat e w it h a Micr osoft Access dat abase or a Microsoft SQL Ser ver dat abase) . Ther efore, before im port ing a Microsoft SQL Server t able ( or a t able fr om any ODBC com pliant dat abase) , you should first creat e a dat a source. You can creat e t he dat a sour ce from Microsoft Access or you can fir st cr eat e it using Cont r ol Panel:

To st art t he dat a sour ce fr om Cont r ol Panel, in Micr osoft Windows XP, you can open t he

Cont rol Panel, open t he Adm inist rat ive Tools, and double- click Dat a Sources ( ODBC) . This w ould open t he ODBC Dat a Sour ce Adm inist rat or:

You can t hen click Add.

To im por t a t able in Microsoft Access, on t he Ribbon, you can click Ext er nal Dat a and, in t he I m xport sect ion, click More - > ODBC Dat abase. This would open t he Get Ext ernal Dat a - > ODBC Dat abase dialog box. I f you w ant t o im por t a t able, you should accept t he first radio but t on and click OK. This w ould open t he Select Dat a Sour ce dialog:

I f you had already creat ed t he dat a source, you can select it and click OK. I f t he Dat a Source is not displaying but you k now where it is locat ed, you can click t he Up One Level but t on t o locat e it s folder and select it . Ot herwise, you can creat e a new dat a source. To do t his, click t he New but t on.

I n bot h cases, you would get t he Cr eat e New Dat a Sour ce dialog box:

From t here, you can click t he t ype of dat abase you want t o im por t . I n t his case, you would click SQL Server. I f you st ar t ed from Cont rol Panel, you w ould click Finish. I f you had st ar t ed from Micr osoft Access, you can click Next . You w ould be pr om pt ed t o ent er a nam e for t he dat a source:

Aft er t yping t he nam e, you can click Next and click Finish. Next , t he Cr eat e a New Dat a Sour ce dialog box wit h t he nam e you previously specified. You are allowed t o t ype a sm all descript ion of t he dat abase. You can t ype anyt hing. Then, in t he Server com bo box, select t he nam e of t he server w her e t he dat abase is locat ed. I f t he dat abase is in t he sam e com put er you are using, you can t ype ( loca l) :

You can t hen click Next :

You can accept all default s or, if you ar e creat ing a sensit ive dat abase t hat would require people t o log in, you can click t he second r adio but t on, t hen pr ovide a user nam e and a passw ord. When ready, click Next . The next page of t he w izar d allow s you t o select t he act ual dat abase t hat has t he t able( s) you w ant t o im port . To select it , you should click t he t op check box t o access it s com bo box. Then click t he ar row of t he com bo box t o display t he list of dat abases and select t he one you want :

Aft er select ing t he dat abase, you can click Next . The last page of t he wizar d allows you t o set som e opt ions. Once you are r eady, you can click Finish:

To m ake sure everyt hing is alr ight , you can click t he Test Dat a Sour ce but t on. I f everyt hing looks alright , you can click OK. I f you had st art ed from t he Cont rol Panel, t he process would end. I f you add st art ed from Micr osoft Access, t he Select Dat a Sour ce dialog box w ould com e back w it h t he dat a sour ce you had j ust creat ed. You can t hen select it :

And click OK. A dialog box would display, cont aining all t he obj ect s t hat belong t o t he dat abase you had select ed. The nam es of t he t ables st art w it h t he schem a nam e, in t his case dbo:

Because t her e are m any obj ect s t hat Microsoft SQL Server creat es for each dat abase, you cert ainly w ould not need all of t hem . Ther efor e, you should select only t he t able ( and pr obably t he views) . To select an obj ect , sim ply click it , t hen click each of t he ot her obj ect s you would need. Once you are ready, click OK. Micr osoft Access w ould st art analyzing and im port ing t he t able( s) . When t he pr ocess is over, a dialog box would let you know. You can t hen click Close. Once you do, t he nam es of t he t ables would appear in t he Navigat ion Pane. Each st ar t s w it h t he schem a nam e and an under scor e. I n m ost cases, you m ay have t o r enam e each by rem oving t he schem a pr efix.

Linking to a M icr osoft SQL Ser ver D atabase


I nst ead of im por t ing t he whole dat abase or som e of it s t able fr om a Micr osoft SQL Server applicat ion, you can cr eat e a proj ect in Micr osoft Access t hat w ould connect t o t he t able from t he server. That way, if you ent er dat a in t he Microsoft Access dat abase, t he dat a w ould be st ored on t he server . This also m akes it possible t o creat e visually good looking obj ect s in Micr osoft Access inst ead of t he som ew hat less friendly t ables of Micr osoft SQL Server ( in realit y, you never want t o let users wor k on t he ser ver and in fact , a visual int erface in Micr osoft Access allow s you t o exercise a great level of cont rol over w hat your users can do or cannot do w it h your dat abase) . To cr eat e an applicat ion in Microsoft Access t hat can com m unicat e wit h t he obj ect s st ored in a Micr osoft SQL Ser ver dat abase, you can link t he t ables fr om Microsoft Access t o t ables of a Micr osoft SQL Server dat abase or you can creat e what is called a dat abase proj ect or sim ply a proj ect . You have various opt ions. Aft er cr eat ing a dat abase in Microsoft SQL Ser ver, t o creat e t ables linked t o it , in Microsoft Access, on t he Ribbon, click Ext ernal Dat a and, in t he Export sect ion, click More - > ODBC Dat abase. I n t he Get Ext er nal Dat a - ODBC Dat abase dialog box, click t he second radio but t on:

Then click OK. The Select Dat a Source dialog box w ould open and you m ust select a dat a source. I f you had not creat ed one, t hen follow t h e st eps t o cre a t e it . I n t he Select Dat a Sour ce dialog ox, click t he dat a source nam e and click OK. This w ould open t he Link t able dialog box. I n t he list of t ables, you should click only t he act ual t ables you will use in Microsoft Access:

Aft er select ing t he t ables, click OK. I f Micr osoft Access needs som e explanat ion about som e t ables ( or views) , you m ay r eceive a dialog box asking you t o ident ify t he r ecor ds unique ident ifiers. When ever yt hing is done, t he linked t ables w ould appear in t he Navigat ion Pane:

Once t he t ables have been linked, you can use t hem as you see fit . You can cr eat e t he for m s and allow t he user s t o exploit t he dat abase. The new r ecor ds would be added t o t he dat abase on t he ser ver.

Expor ting M icr osoft SQL Ser ver Tables


I f you have creat ed a dat abase in Micr osoft Access and w ant t o use it in Micr osoft SQL Ser ver, you can expor t it . Befor e doing t his, you m ust creat e a dat abase in Microsoft SQL Ser ver. I t w ould also be a good idea t o creat e a dat a sour ce, alt hough you can cr eat e it fr om Microsoft Access. To expor t a t able:

I n t he Navigat ion Pane, right - click a t able, posit ion t he m ouse on Export , and click ODBC Dat abase I n t he Navigat ion Pane, click a t able you want t o export . On t he Ribbon, click Ext ernal Dat a and, in t he Export sect ion, click More - > ODBC Dat abase

This would open t he Expor t dialog box t hat asks you t o specify t he nam e of t he t able t hat w ill be creat ed in Micr osoft SQL Server . By default , t he Export dialog box would suggest t he sam e nam e as t he dat abase t hat was select ed:

You can accept it or ent er a new one. Aft er specifying t he nam e of t he t able, click OK. The Select Dat a Source dialog box w ould com e up. I f you had alr eady creat ed a dat a sour ce, you can select it s nam e. Ot herw ise, use t he New but t on t o launch a wizard t hat w ould assist you t o cr eat e a dat a sour ce. Aft er specifying t he dat a source of t he dat abase t hat w ill receive t he t able, click OK. I f everyt hing is alright , t he t able w ould be export ed. Once t he t able has been expor t ed, a dialog box would com e up t o let you know . You can t hen click Close.

U psizing a M icr osoft Access D atabase to a Ser ver D atabase


Micr osoft Access has som e lim it at ions as com pared t o Microsoft SQL Server. For exam ple, Micr osoft Access has lim it s on bot h t he size of a dat abase and t he num ber of people w ho can connect t o a back - end dat abase at t he sam e t im e. I f you find out t hat Micr osoft Access is becom ing t oo r est r aint t o accom m odat e your expanding dat abase, you can upgrade it t o a form al server dat abase. That is, you can t r ansfer t he Microsoft Access dat abase t o a Microsoft SQL Server dat abase w her e it w ould enj oy m ore opt ions. Before upsizing a dat abase, you should enable t he securit y. To do t his, on t he Message Bar,

you can click Opt ions... I f t he Microsoft Office Securit y Opt ions dialog box, click t he Enable This Cont ent radio but t on and click OK. To upsize a Microsoft Access dat abase, open t he dat abase. On t he Ribbon, you can click

Dat abase Tools. I n t he Move Dat a sect ion, click t he SQL Ser ver but t on t he Upsizing Wizar d:

. This w ould open

The first page of t he Upsizing Wizard allows you t o specify w het her you w ill use an exist ing Micr osoft SQL Server dat abase or you w ant t o creat e a brand new one. I f you had already cr eat ed a dat abase on t he server and you only w ant t o add t he t ables ( and queries) t o it , you can select t he first opt ion. I n t his case, you m ust cr eat e a dat a source for t he exist ing dat abase, and follow t he wizard. I f you did not fir st creat e t he server dat abase, you can accept t he second radio. Once you ar e r eady, click Next . I f you had select ed t he first radio but t on, clicking Next w ould open t he Select Dat a Sour ce dialog box. I f you had select ed t he second radio but t on in t he first page of t he w izard before clicking Next , t he second page of t he wizar d w ould com e up:

The second page of t he w izar d allow s you t o specify t he nam e of t he ser ver wher e t he dat abase will be inst alled. You m ust also specify how you w ill be aut hent icat ed. The bot t om sect ion of t he page displays a t ext box w it h a suggest ed nam e of t he server . The nam e is m ade of t he nam e of t he Micr osoft Access dat abase you st art ed from and appended w it h t he "SQL" suffix. You can accept t hat nam e or change it . Once you are ready, click Next . The w izar d would analyze t he dat abase and display t he nam es of t he t ables in t he t hird page of t he w izar d:

The t hir d page allow s you t o select w hat t ables should be creat ed in t he dat abase ser ver:

Aft er select ing t he t ables, you can click Next :

The fourt h page of t he w izard allows you t o specify som e opt ions t hat would be applied t o t he dat abase on t he ser ver. Aft er accept ing t he default s or m aking your select ions, you can click Next :

I n t he sam e way, t he fift h page present s som e opt ions. Once you have reviewed it , accept ed or m aking changes, you can click Next ( or Finish) . The last page only let s you know t hat all inform at ion is ready t o apply on t he server:

You can t hen click Finish. The wizard w ould t hen st art creat ing t he dat abase or applying t he changes:

When t he process is over, a r eport w ould be present ed t o you.

Lesson Sum m ar y
M CAS: U sing M icr osoft Office Access 20 0 7 Topics
S4 E5 Split dat abases I m port dat a

You might also like