Connecting Tech Pros Worldwide Forums | Help | Site Map

Trying to capture data from one table and place it in another

Member
 
Join Date: Mar 2007
Posts: 46
#1: Dec 18 '08
Hi,

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
  1. Private Sub btntest_Click()
  2.    Set rstAllImported = CurrentDb.OpenRecordset("tbl_test", dbOpenTable)   ' this is the input table
  3.    Set rstSleepInterval = CurrentDb.OpenRecordset("tbl_test1", dbOpenDynaset) ' this is the actual data table
  4.  
  5. ' read the input table and see the record that has "Interval Type" can be found
  6.     rstAllImported.MoveLast
  7.     rstAllImported.MoveFirst
  8.  
  9. SkipRecord:
  10.     If rstAllImported.Fields("Actiware Export File  (Version 03#00 )") <> "Interval Type" Then
  11.         rstAllImported.MoveNext
  12.         GoTo SkipRecord
  13.     End If
  14. Me.lblTest.Caption = "success"
  15.  
  16.             Do While Not rstAllImported.EOF
  17.                 If rstAllImported.Fields("Actiware Export File  (Version 03#00 )") Is Null Then    ' find first blank record found
  18.                     'If rstSleepInterval.NoMatch Then
  19.                         Put_Interval_Data
  20.                     'End If
  21.                 Else
  22.                     Me.lblnumberthree.Caption = "is this working?"
  23.                 End If
  24.  
  25.                 rstAllImported.MoveNext
  26.             Loop
  27.  
  28.     rstAllImported.Close
  29.  
  30. End Sub



NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,722
#2: Dec 21 '08

re: Trying to capture data from one table and place it in another


As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question and indeed the instructions in the posting window itself).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use the tags in future.

Administrator.
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,722
#3: Dec 21 '08

re: Trying to capture data from one table and place it in another


Having tidied up the code display somewhat I find I am still at a loss trying to understand your question.

I would at least like to see if I can help. Unfortunately the explanation doesn't seem to be made up of any logical sentences. If you'd like to see if you can explain your problem in clear English (I don't intend to reverse engineer your code to save you the bother of asking the question properly), then I can promise I will at least look at it again.
missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 2,998
#4: Dec 22 '08

re: Trying to capture data from one table and place it in another


As a full member, you should also know better than to post a problem more than once! Your duplicate posting of this problem has been deleted! Please refrain from this prohibited behavior in the future.

From FAQs

Do Not Double Post Your Questions

Double posting is where you start a thread on a topic and then for some reason start another thread on exactly the same topic in the same forum. Please do not do this because

1. It makes it very hard for people to answer you especially if there are answers happening in all the threads you have started because they have to read 2 or more threads in order to see what has already been said.

2. It swamps the forum with your problem resulting in less attention for the other threads.

If you feel for some reason that you post has been overlooked (for instance it hasn't had any replies) please do not repost the question. Post a message to the thread you started, this will bump it back to the top of the thread list for the forum.

Thank you for your attention in this matter.

Linq ;0)>


Moderator
Reply