I'm trying to find some records in a table that has been exported into Access (tbl_test). The new table that I am trying to create and insert the data to is called (tbl_test1).
Here's my code - I'm trying to find where the word 'Interval Type' starts to capture the data from there and on down a few rows. The 'Interval Type' row will be the name of the first field in the new table, and then the second row is blank so I tried looking for a row with a Null Value . . .after that row I want to capture all the data until I reach another Null row- and place all that data into the new table: tbl_test1.
I'm not able to come up with it - please tell me what i'm doing wrong.
Expand|Select|Wrap|Line Numbers
- Private Sub btntest_Click()
- Set rstAllImported = CurrentDb.OpenRecordset("tbl_test", dbOpenTable) ' this is the input table
- Set rstSleepInterval = CurrentDb.OpenRecordset("tbl_test1", dbOpenDynaset) ' this is the actual data table
- ' read the input table and see the record that has "Interval Type" can be found
- rstAllImported.MoveLast
- rstAllImported.MoveFirst
- SkipRecord:
- If rstAllImported.Fields("Actiware Export File (Version 03#00 )") <> "Interval Type" Then
- rstAllImported.MoveNext
- GoTo SkipRecord
- End If
- Me.lblTest.Caption = "success"
- Do While Not rstAllImported.EOF
- If rstAllImported.Fields("Actiware Export File (Version 03#00 )") Is Null Then ' find first blank record found
- 'If rstSleepInterval.NoMatch Then
- Put_Interval_Data
- 'End If
- Else
- Me.lblnumberthree.Caption = "is this working?"
- End If
- rstAllImported.MoveNext
- Loop
- rstAllImported.Close
- End Sub