Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Posts
    48

    Unhappy Unanswered: Possible to assign declared variable to object (e.g. Textbox) in Data Access Pages?

    Hi there!

    I've been trying miserably to assign values from one textbox field in a Data Access Page to control the source URL and .alt value of an image.

    Here is the VBscript I have been trying to use in a Data Access Page, please can anyone tell me why it isn't working?

    Code:
    <SCRIPT language=vbscript event=Current for=MSODSC>
    
    Option Explicit
    
    Dim STATUSLABEL as string
    
    Dim STATUSPIC as string
    
                    STATUSLABEL = txtStatus.Value
        
    	STATUSPIC = txtStatusURL.Value
    	
    	Me!StatusImg.Alt = STATUSLABEL
      
                    Me!StatusImg.Src = STATUSPIC
        
    </SCRIPT>
    Cheers,

    Luke

  2. #2
    Join Date
    Sep 2003
    Location
    Solihull, UK
    Posts
    5
    Hi,

    Just a thought but I seem to remember that you can't declare variable types in vbscript.

    How about sticking a test msgbox in the middle of the code to see if the variables are being recognised and accepting the values you're allocating to them?

    If they're not, then try removing the "as string" bit from your declaraton and see if that helps.

    Other than that your code looks as though it should work. One other thought is if it's in the right event. Perhaps you could insert a test command button and put the code behind the Click event and see if it woks then.

  3. #3
    Join Date
    Aug 2003
    Posts
    48
    Thanks for this!!

    I'll give these ideas a shot!!

    Cheers!

    Luke

  4. #4
    Join Date
    Sep 2003
    Location
    Solihull, UK
    Posts
    5
    No problem.

    Let me know how it works out.

    Rob

Posting Permissions

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