Results 1 to 8 of 8

Thread: Combination data types

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,739
    Location
    1. These are 9 different products stored as 9 simple Strings -- OK

    'data type product 1-3
    Dim DOC As String: DOC = "Product 1"
    Dim DOK As String: DOK = "Product 2"
    Dim DOB As String: DOB = "Product 3"
    
    'data type product 4-6
    Dim KC As String: KC = "Product 4"
    Dim KK As String: KK = "Product 5"
    Dim KB As String: KB = "Product 6"
    
    'data type product 7-9
    Dim SCo As String: SCo = "Product 7"
    Dim SKl As String: SKl = "Product 8"
    Dim SCi As String: SCi = "Product 9"

    2. These are 3 'other' variables - I'm guessing that Dim Sna should be Snack, etc

    'data type combination
    Dim Snack As String: Snack = SCo Or SKl Or SCi
    Dim Dortik As String: Dortik = DOC Or DOK
    Dim Korpus As String: Korpus = KK Or KB
    
    3.
    If (set1.Value = KC And (set1.Value = K1 Or set12.Value = K2) And set13.Value = T2) Then
    What is set1, set2, and set3?
    What is K1, K2, and T2?


    4.
    ElseIf ((set1.Value = DC Or set1.Value = DK Or set1.Value = DCi Or set1.Value = DB Or set1.Value = DM) And set13.Value = Kor) Then
    What is DC, DK, DCi, DB, DM, Kor?


    5. Just taking a guess

    Option Explicit
    
    
    
    
    Sub test()
        Const Snack As String = "SCo#SKl#SCi#"
        Const Dortik As String = "DOC#DOK#"
        Const Korpus As String = "KK#KB#"
        
        If InStr(Snack, "SKl#") > 0 Then
            MsgBox "SKl is a Snack"
        Else
           MsgBox "SKl is not a Snack"
        End If
        
        MsgBox "SKl is " & IIf(InStr(Snack, "SKl#") > 0, "", "not ") & "a Snack"
        MsgBox "KK is " & IIf(InStr(Snack, "KK#") > 0, "", "not ") & "a Snack"
    End Sub

    but if there's a lot, I'd build a mini-database on a worksheet and use that, but it's only a guess since it's not clear to me what you want to do
    Last edited by Paul_Hossler; 05-07-2021 at 12:08 PM.
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

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