Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38

    storing content of a variable

    can someone explain me why the storing of this variable is failing

    var1 = Me!cod_personale.Column(2)

    where cod_personale is a combobox (to be selected) in a form

    I want to retrieve and store in a variable the content of a related field
    from a query set as origin of the row for the combo box itself (which is originally used for another purpose)

    is that too much confused? any help for this?



    thanks

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What value is in the 3rd column that you are trying to store?

  3. #3
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38
    an email address, I would say a string?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It is a zero based reference so Column(2) is the 3rd column, right?

  5. #5
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38
    yes, it is

  6. #6
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38
    it says run-time error 94

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Where do you have that code?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    var1 = Nz(Me!cod_personale.Column(2))
    Error 94 is Invalid use of a Null

  9. #9
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38
    for some reasons, it's returning a null value...
    still trying to understand why

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Just before that line put:
    MsgBox Me!cod_personale.Column(2)
    ...and see what happens.

  11. #11
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38
    it's exactly what I've done

    in case of
    MsgBox Me!cod_personale.Column(2)
    it is returning an error 94

    whilst in case of
    MsgBox Nz(Me!cod_personale.Column(2))
    is retuning a void message box

    the strange thing is that for other column() the method is working fine!

    can be something related to the content of that field (an email address that has some special characters in it like ...@....)?

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    MsgBox "[" & Len(Me!cod_personale.Column(2)) & "]"
    Debug.Print Me!cod_personale.Column(2)
    then look in the immediate window for the Print.

  13. #13
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38
    the msg box is returning []
    the immediate window is printing null

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What values do you have in the Column Count and Column Widths properties? It sure looks like a Null now.

  15. #15
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38
    ohhhh yes!
    that was: the column count was not properly set !!!!!!!!!!!
    now it works!

    thanks a lot for helping me in this long debugging session
    I've learned a lot, thanks again

    m

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. How do you file save an 'Attachment' content through code?
    By morespamforya in forum Programming
    Replies: 3
    Last Post: 08-06-2010, 08:58 AM
  2. Replies: 4
    Last Post: 08-05-2010, 01:26 PM
  3. Refering to variable form names inside a variable
    By redpetfran in forum Programming
    Replies: 2
    Last Post: 05-21-2010, 01:39 PM
  4. Replies: 1
    Last Post: 02-04-2010, 11:17 AM
  5. Emailing report at the Email content
    By ylivne in forum Reports
    Replies: 0
    Last Post: 07-07-2009, 05:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums