SunQuest
 
      Visual Basic
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Tutorialized ForumsDesktop ProgrammingVisual Basic

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old January 2nd, 2008, 09:53 PM
hally hally is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 11 hally User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 36 sec
Reputation Power: 0
Unhappy Vb Help!! Changing and matching the code from one table to another..

I got 1 file ( Trade.mdb ).. Inside this file I got 3 table which is Data151, MKCW442 and KOR_tbl.. I already right the coding.. But it still didn't work..


So when user choose file Data151 and click button process.. I want it to be like this:

1. Read the field Ctry. If the field Ctry = Asean Country which is ( MY, TH, SG, BN, ID, PH, KH, MM, VN, LA ) then have to compare with field HS in table Data151 and compare also with field AHTN 2004 or field AHTN_ABJAD 2004 in table Master1

2. If same, then transfer the all information from field AHTN10_2007 in table Master1 to the new table ( Output )

3.Transfer all the information that have been modified or not to the new table ( Output )

3. After finish process, must come out one message box which is PROCESS COMPLETED

Code:
Private Sub cmdProses_Click()

Dim strpilih As String
Dim strpilih2 As String
Dim strpilih3 As String
Dim rspilih As Recordset
Dim rspilih2 As Recordset
Dim rspilih3 As Recordset

'When user choose eg. Input151 then click the button Process, this will happen :
'Read the field Ctry (From table Data151)
'If field Ctry =Asean Country which is (MY,TH,SG,BN,ID,PH,KH,MM,VN,LA)
'Then have to compare field HS (From table Data151) with field AHTN2004 or AHTN_ABJAD 2004 (From table KOR_tbl)
'If same, then transfer all the information from field AHTN10_2007 (From table KOR_tbl) to the field hscode (New table which is Output)
'Transfer all the records that had been modified or not to the new table (Output)
'After finish process, must come out the message box " PROCESS COMPLETED "

If Pilihan.Text = "Input151" Then

    Set rspilih = New Recordset
    strpilih = "Select * from Data151"
    rspilih.Open strpilih, cn2, adOpenForwardOnly, adLockReadOnly
    
    rspilih.MoveFirst
    Do While Not rspilih.EOF
     Loop
        MsgBox rspilih.Fields("Ctry")
        If rspilih.Fields("Ctry") = "MY" Then
        
'compare field hscode table INPUT151 with field AHTN 2004/field AHTN_ABJAD 2004 (table KOR_tbl)
                              
      Set rspilih2 = New Recordset
      strpilih2 = ("Select * HS from Data151") And ("Select * (AHTN 2004 OR AHTN_ABJAD 2004 ) from KOR_tbl")
      rspilih2.Open strpilih2, cn1, adOpenForwardOnly, adLockReadOnly
      
      rspilih2.MoveFirst
      Do While Not rspilih2.EOF
      
'If same, then transfer all the information from field AHTN10_2007 (From table KOR_tbl) to the field hscode (New table which is Output)

      Set rspilih3 = New Recordset
      strpilih3 = ("Select * AHTN10_2007 from table KOR_tbl")
      rspilih3.Open strpilih3, cn3, adOpenForwardOnly, adLockReadOnly
      

End If
End Sub



Thank you so so much...

Reply With Quote
Reply

Viewing: Tutorialized ForumsDesktop ProgrammingVisual Basic > Vb Help!! Changing and matching the code from one table to another..


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway