Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to capture data from a table that I have to create a new table

Status
Not open for further replies.

tmpennin

Programmer
Dec 16, 2008
2
US
I am trying to create a new table from an existing table. The existing table is created from an import command ( DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "tbl_test", "S:\vata\surlak - Go To Sleep\Import Data Code\Actiwatch sample.xlsx", True). I have to find where the new table should start from the imported table and capture all my data that is needed.

I'm looking for the keyword 'Marker' in the existing imported table "tbl_test".
So here's what I have - having gotten help from acces help, but I cannot seem to grasp what I am doing and how to do it. Also the table that this data gets imported into (tbl_test) does not have any field names - so it defaults to "F1" as the first column.

Open tbl_test1 for Input as #1
Do While Not tbl_test.EOF And tbl_test.EOF("F1") <> "Marker"
Line Input #1, (i don't know what goes here - imported table name or new table name i want to create)
Debug.Print InputData (I want it to go to the new table)
Loop
Close tbl_test


 
Use a query to read a table:
SELECT * FROM tbl_test WHERE F1 <> 'Marker'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Okay - I think I'm getting somewhere . . .
here's what I've done so far.



Private Sub btntest_Click()
Set rstEBPData = CurrentDb.OpenRecordset("tbl_test1", dbOpenTable) ' this is the input table
Set rstACTData = CurrentDb.OpenRecordset("tbl_test", dbOpenDynaset) ' this is the actual data table

' read the input table and see if I can find the word 'Marker'in the file
rstEBPData.MoveLast
rstEBPData.MoveFirst

SkipRecord:
If rstEBPData.Fields("Marker") = Null Then
rstEBPData.MoveNext
GoTo SkipRecord
End If

End Sub

But for sure - the statement:
If rstEBPData.Fields is incorrect - due to not having any fields defined in the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top