Hello, I'm a little confused by your posting and hoped that maybe you could clarify some things so that we can figure this out. I'm going to type what I believe to be true, and hopefully you can correct me where I am wrong.
You have a subVI in a program (is this an executable?). The subVI sends a command to your Network Analyzer, and you expect the Network Analyzer to return with the type of sweep it is executing. Is there an input to this subVI where you instruct which commands get sent to your instrument? There is a while loop somewhere - in the subVI, or around the subVI? When you send the instrument the query to return the sweep mode it is in, it returns the wrong information. Are you sure that the instrument is receiving the command? You are also able to send this command in the Measurement and Automation Explorer. Are you communicating with your instrument with VISA calls? Everything works fine if you copy the VI to a blank VI. But this VI is not within the actual program that you would like to use in the end? Is there still this while loop that's causing the VI to continuously run? Speculating, it sounds like a timing issue where you are reading the response from the instrument before the command ever really gets executed. I'm sure that you can clear up a lot of my uncertainties with a few answers, so please do so. Thanks.