Consulting

Results 1 to 3 of 3

Thread: Vb Code To VBA

  1. #1
    VBAX Regular
    Joined
    Apr 2010
    Posts
    32
    Location

    Vb Code To VBA

    I would very much appreciate it if someone could help me with converting the VB 2010 code below to Access 2010 VBA

    Public Class CustomerList
    Private mCustName As String
    Private mCustID As Integer

    Public Sub New(ByVal pText As String, ByVal pValue As Integer)
    mCustName = pText
    mCustID = pValue
    End Sub

    Public ReadOnly Property CustName() As String
    Get
    Return mCustName
    End Get
    End Property

    Public ReadOnly Property CustID() As Integer
    Get
    Return mCustID
    End Get
    End Property

    Public Overrides Function ToString() As String
    Return mCustName
    End Function

    End Class

    What it does, in VB 2010, is store the customer name and ID so that when the customer name is selected in a combobox you can use the CustomerID to pass to a SQL stored procedure.

    Thanks

  2. #2
    VBAX Tutor
    Joined
    Mar 2014
    Posts
    208
    Location
    We dont use 'Get' (.net).
    Access combos get data from tables/qrys.
    The queries then reference the combo val...no need for modular variables.

    it would be: forms!frmMain!cboCust
    but for a Class, you need to view old VB6 version of class assigned module level variables.

  3. #3
    VBAX Tutor
    Joined
    Mar 2014
    Posts
    208
    Location
    Public Property Get Subject() As Variant
    Subject = mvSubject
    End Property
    
    Public Property Let Subject(ByVal vNewValue As Variant)
    mvSubject = vNewValue
    End Property

Posting Permissions

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