Results 1 to 7 of 7

Thread: [RESOLVED] Query value from Table (Excel File)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2021
    Posts
    18

    Resolved [RESOLVED] Query value from Table (Excel File)

    Hello, I have this code that work



    Code:
    Dim T As Table= C("someModelTable")   'C mean copy the table(someModelTable),this command come from the software from where I work 
    Dim Rows() As Integer = T.StartQuery 
    
    For i As Integer = 0 To Rows.Length-1  
    	Dim model As String  
    	model = (T.Cell( Rows(i) , "Code") )  
    	If Q("TXB_CODE_ING").Contains(model) Then         'Q mean query  the value
    		Q("CMB_Catalog_Number")  = model               
    	End If 	 
    Next i
    As I said this code work, it will display the model that it find in a textbox in a cmbbox.

    There problem I have is if I want to add a "else if" in case the model is not valid, well the program will always go to this "else if" , like if the model is never valid.
    I beginner but I just don't understand why, do its because I work with a Excel file??

    Thank you!
    Last edited by VirtualTurnip3; Jun 8th, 2021 at 02:54 PM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: Query value from Table (Excel File)

    If you want help with code that doesn't work, maybe you could show us that code.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2021
    Posts
    18

    Re: Query value from Table (Excel File)

    Quote Originally Posted by jmcilhinney View Post
    If you want help with code that doesn't work, maybe you could show us that code.
    You right! It seem I forgot to copy it, but by the time I have found my problem, I forget a simple "Exit for".

    Thank!

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: Query value from Table (Excel File)

    I'm not sure how you found the issue in the end but this is why you need to use the debugger and you need to do so before posting a question. Set a breakpoint at the top of the code and then step through it line by line. You can then see exactly what path execution takes and what values all your variables and other expressions contain and compare that to your expectations. That will almost always show you WHERE the issue is and WHAT the issue is, even if it doesn't tell you how to fix it. You need to provide us with that debugging information.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: Query value from Table (Excel File)

    If your problem has been resolved, please use the Thread Tools menu to mark this thread Resolved, so everyone knows that you need no more help without opening the thread and read it all.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    May 2021
    Posts
    18

    Re: Query value from Table (Excel File)

    Quote Originally Posted by jmcilhinney View Post
    I'm not sure how you found the issue in the end but this is why you need to use the debugger and you need to do so before posting a question. Set a breakpoint at the top of the code and then step through it line by line. You can then see exactly what path execution takes and what values all your variables and other expressions contain and compare that to your expectations. That will almost always show you WHERE the issue is and WHAT the issue is, even if it doesn't tell you how to fix it. You need to provide us with that debugging information.
    Allright no problem!

  7. #7

    Thread Starter
    Junior Member
    Join Date
    May 2021
    Posts
    18

    Re: Query value from Table (Excel File)

    All ok!
    Last edited by VirtualTurnip3; Jun 9th, 2021 at 12:43 PM.

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