Results 1 to 5 of 5

Thread: help please..

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    7

    help please..

    hi,
    the following is my coding to capture value and then display out the value.
    Code:
    Private Sub Form_Load()
    Dim i As Integer
    Dim id, nilai As String
    Dim xL As cLine
    
        clearScreen
        i = 1
        Me.Icon = frmMDI.ActiveForm.Icon
        ''clearScreen
        ''new function to display ERD database tablename n field
        ' 1st check shape.collection value
        
        'If frmMDI.ActiveForm.lblLineCap(i).Caption = "M" Then
        For i = 1 To frmMDI.ActiveForm.theBlockCollection.Count
        
        
            With frmMDI.ActiveForm.theBlockCollection(frmMDI.ActiveForm.shp(i).Tag)
            Dim st, st1, st2, dist As Integer
            Dim a, b, pos, na, na1 As String
              
                
            
            If .zAction <> "LINK" And .zAction <> "STAR" Then
                id = .TagID
                
            For Each xL In frmMDI.ActiveForm.theLineCollection
                
                
                If id = xL.sFrom Then
                    nilai = xL.sCaption
                End If
                
                
                If nilai = "M" Then
                    na1 = na
                    na = .zParam1
                
                    If na <> na1 Then
                        'sMessage = "Nama Entiti: " & .zParam1 & vbLf
                        dist = Len(.zParam2)
                        st = 1
                
                
                        Do While dist > 1
                              
                            st1 = InStr(st, .zParam2, vbCr & vbLf, vbTextCompare) + 1
                            'st2 = st - st1
                            
                            st2 = st1 - st
                           
                            
                            'a = Mid(.zParam2, st, st2)
                            a = Mid(Replace(.zParam2, vbCr, ""), st, st2)
                            dist = dist - Len(a)
                   
                            a = Left(a, Len(a) - 1)
                   
                            pos = InStr(a, "@")
                            b = Mid(a, 1, pos - 1)
                             
                            a = Mid(a, pos + 1)
                  
                            st = st1
                   
                            
                            'MsgBox ("haha" & b & "haha")
                   
                            If (a = "PK") Or (a = "FK") Then
                                If sM <> "" Then
                                    sM = sM & "," & b
                                Else
                                    sM = .zParam1 & "(" & b
                                End If
                            End If
                    
                            If (a = "PK") Or (a = "") Then
                                If sM1 <> "" Then
                                    sM1 = sM1 & "," & b
                                Else
                                    sM1 = .zParam1 & "(" & b
                                End If
                            End If
                        Loop
                        sM = Trim(sM) & ")"
                        sM1 = Trim(sM1) & ")"
                        'MsgBox Trim(sM)
                        'MsgBox Trim(sM1)
                        
                        
                        sMessage = sMessage & sM
                        inputLine (sMessage & vbCr)
                        sMessage = sM1
                        inputLine (sMessage & vbCr)
                        sMessage = ""
                        sM = ""
                        sM1 = ""
        
                End If
            End If
            
    Dim temp_id As String
    Dim temp_penentu As String
    Dim temp_bersandar As String
    Dim na1x, nax As String
    
    
            If nilai = "1" Then
                na1x = nax
                nax = .zParam1
    
                If nax <> na1x Then
                    temp_id = .TagID
    
                    If temp_id = .IDRules Then
                        temp_penentu = .atribut_di
                        temp_bersandar = .atribut_ber
                        dist = Len(.zParam2)
                        st = 1
    
                        Do While dist > 1
    
                            st1 = InStr(st, .zParam2, vbCr & vbLf, vbTextCompare) + 1
                            st2 = st1 - st
                            a = Mid(.zParam2, st, st2)
                            'a = Mid(Replace(.zParam2, vbCr, ""), st, st2)
                            dist = dist - Len(a)
    
                            a = Left(a, Len(a) - 1)
    
                            pos = InStr(a, "@")
                            b = Mid(a, 1, pos - 1)
                            a = Mid(a, pos + 1)
    
                            st = st1
    
                            If (b = temp_penentu) Or (b = temp_bersandar) Then
                                If sM <> "" Then
                                    sM = sM & "," & b
                                Else
                                    sM = .zParam1 & "(" & b
                                End If
                            Else
                                If sM1 <> "" Then
                                    sM1 = sM1 & "," & b
                                Else
                                    sM1 = .zParam1 & "(" & b
                                End If
                            End If
                        Loop
                        sM = sM & ")"
                        sM1 = sM1 & ")"
                        
                        
                    sMessage = sMessage & sM
                    inputLine (sMessage & vbCr)
                    sMessage = sM1
                    inputLine (sMessage & vbCr)
                    sMessage = ""
                    sM = ""
                    sM1 = ""
    
                    End If
                End If
            End If
           
            
        Next xL
        End If
            
        
        End With
        Next i
       
    End Sub

    the output of this coding is as below:

    entityName (attribute_a,
    attribute_b,
    attribut_c)


    but, the actual output that i should have is as below:

    entityName(attribute_a, attribute_b, attribut_c)


    what should i do to solve this problem?
    Last edited by janiceteh04; May 28th, 2007 at 11:02 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width