VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Connects the program to the Registry and is used within the program. thus flexible to input company

by Michael Mwaura (2 Submissions)
Category: Registry
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 29th April 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Connects the program to the Registry and is used within the program. thus flexible to input company information of your choice

API Declarations



Global Database As New ADODB.Connection 'Connecting the Database
Global CompanyName As String 'Writing company name in the Windows registry
Global BranchCode As String 'Writing branch code in the Windows registry
Global BranchName As String 'Writing branch name entry in the Windows registry
Global ProductID As String 'Writing productID entry in the Windows registry
Global FormName As String 'Used to show the search screen under a particular form
Global UserName As String 'Used to show the Name of any User Or Employee with Access to the programs
Private Sub Main()
Load FrmWelcome
FrmWelcome.Show
End Sub


Rate Connects the program to the Registry and is used within the program. thus flexible to input company



Option Explicit

Private Sub Form_Load()
On Error GoTo ErrorHandler
    CentreScreen Me
    'This is will save the companys' details in the Registry. This line will create a folder in the Registry called Pharmacy Stock Control and within it you will find another form which will store the company's detail
    CompanyName = GetSetting("PHARMACY STOCK CONTROL", "COMPANY DETAILS", "COMPANYNAME")

    If CompanyName = "" Then
RepeatCompany:
        CompanyName = InputBox("Please Enter The Company Name For This Setup", "COMPANY NAME")

        If CompanyName = "" Then GoTo RepeatCompany
        SaveSetting "PHARMACY STOCK CONTROL", "COMPANY DETAILS", "COMPANYNAME", CompanyName

    End If

    'Display the Company Name on the form
    LblCompanyName.Caption = CompanyName

    BranchCode = GetSetting("PHARMACY STOCK CONTROL", "COMPANY DETAILS", "BRANCHCODE")
    BranchName = GetSetting("PHARMACY STOCK CONTROL", "COMPANY DETAILS", "BRANCHNAME")
    ProductID = GetSetting("PHARMACY STOCK CONTROL", "COMPANY DETAILS", "PRODUCT ID")

    If BranchCode = "" Then
RepeatCode:
        BranchCode = InputBox("Please Enter The Branch Code For This Setup", "BRANCH CODE")
        If BranchCode = "" Then GoTo RepeatCode
        SaveSetting "PHARMACY STOCK CONTROL", "COMPANY DETAILS", "BRANCHCODE", BranchCode
    End If

    If BranchName = "" Then
RepeatName:
        BranchName = InputBox("Please Enter The Branch Name For This Setup", "BRANCH NAME")
        If BranchName = "" Then GoTo RepeatName
        SaveSetting "PHARMACY STOCK CONTROL", "COMPANY DETAILS", "BRANCHNAME", BranchName
    End If

    'Display the Branch Name on the Form
    LblConsumerName.Caption = BranchName

    If ProductID = "" Then
RepeatProductID:
        ProductID = InputBox("Please Enter The Product ID For This Setup", "PRODUCT ID")
        If BranchName = "" Then GoTo RepeatName
        SaveSetting "PHARMACY STOCK CONTROL", "COMPANY DETAILS", "PRODUCT ID", ProductID
    End If

    'Display the Product ID on the Form
    LblProductID.Caption = ProductID
'***********************************************************************
    'Connecting to the Database via ODBC
    Database.ConnectionString = "MIKE"
    'Open the database
    Database.Open
'****************************************************************
Exit Sub
ErrorHandler:
MsgBox ("The system is not connected to the DATABASE  " & vbNewLine & " Please contact your System Administrator to Link this Program's Database to the ODBC in the Control Panel"), vbCritical + vbOKCancel

End Sub

Private Sub WelcomeTimer_Timer()
    Unload FrmWelcome
    Load frmLogin
    frmLogin.Show
End Sub



Download this snippet    Add to My Saved Code

Connects the program to the Registry and is used within the program. thus flexible to input company Comments

No comments have been posted about Connects the program to the Registry and is used within the program. thus flexible to input company. Why not be the first to post a comment about Connects the program to the Registry and is used within the program. thus flexible to input company.

Post your comment

Subject:
Message:
0/1000 characters