dbTalk Databases Forums  

Can this be done in Access

comp.database.ms-access comp.database.ms-access


Discuss Can this be done in Access in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bob
 
Posts: n/a

Default Can this be done in Access - 07-29-2003 , 01:01 PM






Hello

Hello

I have an excel spreadsheet that that will be named different each
time. What I need to do is be able to open the file in free file and
have the data populate text boxes on 3 forms. I may be able to squeeze
al the boxes on to 1 or 2 forms if need be (Hopefully) I need to
populate the textboxes so I can update the database after I verify
that all the fields have the correct info in them. Can this be done?

Thanks Bob

Dim ExApp As Object
Dim WkBk As Object
Dim WkSht As Object
Dim tmpSheet As Object
'Set myexcel = CreateObject("Excel.Application")

Set ExApp = CreateObject("Excel.Application") 'Creates new instance
of Excel
strFile = ExApp.GetOpenFilename 'Opens dialog box so user can
pick file to open
Set WkBk = ExApp.Workbooks
WkBk.Open strFile 'Opens chosen file
Set WkSht = ExApp.ActiveSheet 'Selects the active (topmost)
worksheet

'On Form1
txtAdd.Text = WkSht.Cells(7, 3) 'Puts the cell value into the
text box
txtAdd2.Text = WkSht.Cells(8, 3)
txtAdd3.Text = WkSht.Cells(9, 3)
txtCity.Text = WkSht.Cells(10, 3)
txtContact.Text = WkSht.Cells(11, 3)
txtCustomer.Text = WkSht.Cells(6, 3)
txtDate.Text = WkSht.Cells(2, 5)
txtPhone.Text = WkSht.Cells(11, 8)
txtShipper.Text = WkSht.Cells(5, 3)
txtState.Text = WkSht.Cells(10, 6)
txtTech.Text = WkSht.Cells(2, 8)
txtZip.Text = WkSht.Cells(10, 8)

'On Form2
txtCams.Text = WkSht.Cells(17, 3)
txtCPU.Text = WkSht.Cells(19, 3)
txtIP.Text = WkSht.Cells(18, 3)
txtLic.Text = WkSht.Cells(18, 8)
txtMail.Text = WkSht.Cells(17, 8)
txtModem.Text = WkSht.Cells(16, 8)
txtOS.Text = WkSht.Cells(16, 3)
txtSoftWare.Text = WkSht.Cells(15, 3)
txtVer.Text = WkSht.Cells(15, 7)

'On Form3
txtAddPtr.Text = WkSht.Cells(29, 4)
txtAddPtr1.Text = WkSht.Cells(29, 6)
txtAddPtr2.Text = WkSht.Cells(29, 8)
txtKey.Text = WkSht.Cells(26, 4)
txtKey1.Text = WkSht.Cells(26, 6)
txtKey2.Text = WkSht.Cells(26, 8)
txtMon.Text = WkSht.Cells(25, 4)
txtMon1.Text = WkSht.Cells(25, 6)
txtMon2.Text = WkSht.Cells(25, 8)
txtMse.Text = WkSht.Cells(27, 4)
txtMse1.Text = WkSht.Cells(27, 6)
txtMse2.Text = WkSht.Cells(27, 8)
txtOther.Text = WkSht.Cells(31, 4)
txtOther1.Text = WkSht.Cells(31, 6)
txtOther2.Text = WkSht.Cells(31, 8)
txtRpt.Text = WkSht.Cells(28, 4)
txtRpt1.Text = WkSht.Cells(28, 6)
txtRpt2.Text = WkSht.Cells(28, 8)
txtScale.Text = WkSht.Cells(30, 4)
txtScale1.Text = WkSht.Cells(30, 6)
txtScale2.Text = WkSht.Cells(30, 8)
txtSysUnit.Text = WkSht.Cells(24, 4)
txtSysUnit1.Text = WkSht.Cells(24, 6)
txtSysUnit2.Text = WkSht.Cells(24, 8)

ExApp.Workbooks.Close
Set ExApp = Nothing
Set WkBk = Nothing
Set WkSht = Nothing


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.