Jump to content

Recommended Posts

Can someone help me with this I want to convert some vb code into php Im not a programmer so I need all the help I can get. I have several vb code pages to convert, but Im thinking if I can see how this one would look I might beable to figure the rest out by excample.

Option Compare Database
Public XTrk_Name As String
Public XTrk_Oper As String
Public XTrk_Short_Name As String
Public XTrk_Desc As String
Public XTrk_ID As Long
Public XHome_ID As Long
Public XHomeSet As Boolean

Public Sub SetHomeTrack()

    Dim VarX As Variant
        
    VarX = ""
        
        VarX = DLookup("[Trk_Name]", "Track_Master", "[Trk_Home] = True")
            If Nz([VarX], "") = "" Then
                XTrk_Name = "Points Management System"
                XHomeSet = False
            Else
                XTrk_Name = VarX
                XHomeSet = True
            End If
                    
    VarX = ""
            
            VarX = DLookup("[Trk_Short_Name]", "Track_Master", "[Trk_Home] = True")
                If Nz([VarX], "") = "" Then
                    XTrk_Short_Name = "Home Trk Not Setup"
                Else
                    XTrk_Short_Name = VarX
                End If
    VarX = ""
            
            VarX = DLookup("[Trk_Oper]", "Track_Master", "[Trk_Home] = True")
                If Nz([VarX], "") = "" Then
                    XTrk_Oper = "Home Oper Not Setup"
                Else
                    XTrk_Oper = VarX
                End If
        
    VarX = ""
            VarX = DLookup("[Trk_Desc]", "Track_Master", "[Trk_Home] = True")
                If Nz([VarX], "") = "" Then
                    XTrk_Desc = "Home Desc Not Setup"
                Else
                    XTrk_Desc = VarX
                End If
                
    VarX = ""
            VarX = DLookup("[Trk_ID]", "Track_Master", "[Trk_Home] = True")
                If Nz([VarX], "") = "" Then
                    XTrk_ID = 0
                    XHome_ID = 0
                Else
                    XTrk_ID = VarX
                    XHome_ID = VarX
                End If
End Sub

Function ParseTime(InTime, Outtime)
    'Determine The Format
    
    For x = 1 To Len(InTime)
        If Mid(InTime, x, 1) < 0 Or Mid(InTime, x, 1) > 9 Then
            Mid(InTime, x, 1) = ":"
        End If
    Next x
    Outtime = InTime
End Function
Function IsLoaded(ByVal strFormName As String) As Integer
' Returns True if the specified form is open in Form view or Datasheet view.
    
    Const conObjStateClosed = 0
    Const conDesignView = 0
    
    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
        If Forms(strFormName).CurrentView <> conDesignView Then
            IsLoaded = True
        End If
    End If
    
End Function
Public Function GetHomeTrack(Track_Data, Get_Data)
    
    Select Case Get_Data
    
        Case 1
            VarX = ""
            VarX = DLookup("[Trk_Name]", "Track_Master", "[Trk_Home] = True")
                    Track_Data = VarX
                    
                If Nz([VarX], "") = "" Then
                
                    If Not IsLoaded("CM_TRK_MASTER_01") Then
                        Msg = "You must setup at least one Track as the Home Track" & Chr(10) & Chr(13)
                        Msg = Msg & "Open the Track Master Control Setup and Select a Home Track"
                        MsgBox Msg
                        Cancel = True
                    End If
                Else
                    Home_Setup = True
                End If
                    
        Case 2
            VarX = ""
            VarX = DLookup("[Trk_Short_Name]", "Track_Master", "[Trk_Home] = True")
                    Track_Data = VarX
        Case 3
            VarX = ""
            VarX = DLookup("[Trk_Oper]", "Track_Master", "[Trk_Home] = True")
                    Track_Data = VarX
        Case 4
            VarX = ""
            VarX = DLookup("[Trk_Desc]", "Track_Master", "[Trk_Home] = True")
                    Track_Data = VarX
        Case 5
            VarX = ""
            VarX = DLookup("[Trk_ID]", "Track_Master", "[Trk_Home] = True")
                    Track_Data = VarX
                    
        End Select
        VarX = ""
End Function

 

Link to comment
https://forums.phpfreaks.com/topic/139604-visual-basic-in-a-php-file/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.