Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Here is the problem I am using a Rube Goldberg device to get two
programs to work with each other the first is a database which exports records from its proprietary database format to excel. So I have taken all of these excel files and consolidated them using code that I have written now here is the problem I am trying to get the code to import the serial # and the class name into the access database. But when I do I get a 3421 data mismatch error. This is because the class field is actually a lookup field with a primary key that is a number and a description that is a memo I am trying. The lookup needs to be a text input but it logs by class number Sub DAOFromExcelToAccess() ' exports data from the active worksheet to a table in an Access database ' this procedure must be edited before use Dim db As Database, rs As Recordset, r As Long Set db = OpenDatabase("C:\Documents and Settings\fiskb001\Desktop \2009.mdb") ' open the database Set rs = db.OpenRecordset("main table", dbOpenTable) ' get all records in a table r = 3 ' the start row in the worksheet Do While Len(Range("A" & r).Formula) < "" ' repeat until first empty cell in column A With rs .AddNew ' create a new recor .Fields("Serial #") = Range("B" & r).Value .Fields("class") = Range("C" & r).Value ' add more fields if necessary... .Update ' stores the new record End With r = r + 1 ' next row Loop rs.Close Set rs = Nothing db.Close Set db = Nothing End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Tracking inventory in excell or access | Excel Worksheet Functions | |||
Importing data from excell to access. | Excel Discussion (Misc queries) | |||
Unable to access my Excell 2003 | Setting up and Configuration of Excel | |||
Importing data from Access into Excel: prob w/ cutting off fields | Excel Worksheet Functions | |||
Why can't we see or access MS Excell 2003 even though we have MS . | Setting up and Configuration of Excel |