smengayau 0 Report post Posted November 19, 2008 assalam,mualaikum...leh tolong tak..... saya baru belajar nak buat database..mcm mana kita nak link kan data kita dari ms access ke ms excel?contohnya... saya ada data dalam ms access dan saya ada buat tamplet kat ms excel.mcm mana saya nak masukkan data yang telah siap dalam ms access tu nak di link ke tamplet di ms excel?? maksud saya... apa arahan dalam form tu yang ke di ubah atau perlukan satu form khas untuk link kan ke 2-2 ms tu??? Quote Share this post Link to post Share on other sites
smengayau 0 Report post Posted November 20, 2008 tak ada orang nak bantu saya ker ???? plz.... Quote Share this post Link to post Share on other sites
musiclover 0 Report post Posted November 20, 2008 yeaa .. saye cube bantu .. sebelom tu saye nak tanye awak .. data yang masuk tu data yang gunakan SQL yang sama atau berlainan ... i mean template yang kamu gunakan susun data sama macam database tak ..? Quote Share this post Link to post Share on other sites
musiclover 0 Report post Posted November 20, 2008 Bro U try That ... i'll build for U ... Dim sqlstr As Stringsqlstr = "CREATE TABLE tlkp_ContactType " & _"(ContactType text, Description text)"DoCmd.RunSQL sqlstr' Now add the unique data from the imported contacts table' This is the SQL equivalent of an Append action querysqlstr = "INSERT INTO tlkp_ContactType " & _"( ContactType, Description ) " & _"SELECT ContactType, ContactType AS Description " & _"FROM Contacts " & _"GROUP BY ContactType, ContactType;"Call ChangeTitle_FX("Appending To tlkp_ContactType")DoCmd.RunSQL sqlstrAnother of these SQL commands creates a primary index on the Lookup table.sqlstr = "CREATE UNIQUE INDEX " & _" MyIndex ON tlkp_ContactType (ContactType) With Primary"DoCmd.RunSQL sqlstrNow I use a DAO library method to build a one to many cascading relationship between the tables. This has no equivalent command in SQL or in ADO. To find help on this topic, use Access 97 if you can because the DAO help in Access 2000 is very elusive. A good practice illustrated here is to add the "DAO." definition to all DAO objects. When I was developing this routine, I spent a long time debugging this code in Access 2000 because ADO took precedence and the errors that were returned on the append method lead me on a wild goose chase.Dim dbsBuild As DAO.DATABASEDim relatNew As DAO.RelationSet dbsBuild = CurrentDbSet relatNew = dbsBuild.CreateRelation("MyRelationship", _"tlkp_ContactType", "contacts", _dbRelationUpdateCascade)With relatNew' Need to create a field in relation object prior to' defining the name of the external field..Fields.Append .CreateField("ContactType").Fields!ContactType.ForeignName = "ContactType"dbsBuild.Relations.Append relatNewEnd WithAnd to complete the process, the building routine initially has to delete the relationship and the the lookup table in case either of them exist in the database. This deletion of relationships using code is important as the SQL drop table command will not work whilst a relationship is in place. Note that I turn off the error tracking for this section of the code so that the software will just continue on if the tables and relationships do not exist.On Error Resume Next' Delete the relationship if it existsSet dbsBuild = CurrentDbWith dbsBuild.Relations.Delete "MyRelationship".CloseEnd With' Delete the table in case it exists.DoCmd.RunSQL "Drop table tlkp_ContactType"On Error GoTo 0 Quote Share this post Link to post Share on other sites
smengayau 0 Report post Posted November 20, 2008 (edited) saya guna visual basic... ekekeke.... saya baru nak belajar ba ni... saya ada 1 software database orang punya... saya teringin sangat nak buat... yang saya tengok tu.. dalam cd tu just ada mc access dan ms excel yang mana templetnya ada pada ms excel dan datanya ada pada ms access. ekeke... tolong terangkan pada saya napa mcm tu.... saya tak faham.. maklumlah tak ada sekolah tinggi ni... bye.. Edited November 20, 2008 by smengayau Quote Share this post Link to post Share on other sites