Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Loudon, New Hampshire, USA
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Blanks (Access 2003/Windows XP)

    Hi All,
    I have a field on a form to which I move spaces it via VBA to. (Me!MyField = " ") On another form I check to see if the field contains spaces. (If Me!MyField = " " then bytNo = 5 End If) My problem the If statement does not work. The field has spaces in it, I checked it in debug, the field is blank. I also ran a query testing for spaces and it worked. It found the records with spaces in MyField. So why doesn't the If work????

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Blanks (Access 2003/Windows XP)

    Immediately after

    Me!MyField = " "

    MyField will be " " on the fom, but not yet in the table, because the record hasn't been saved yet. So another form based on the same table will not "see" the space. Only when the record has been saved (for example by moving to a new record) will the second form "see" the space.

  3. #3
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Loudon, New Hampshire, USA
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Blanks (Access 2003/Windows XP)

    Sorry I was not clear Hans. The first Me!MyField = " " was in form one. The record was saved in form one. Then form two opens the record, this is the one that I do the If Me!MyField = " " then bytField = 1 end if. It this statement that is not working. As I said before the debug says that the MyField has spaces. I even check the MyField for Null and Empty, and it does not move 1 to the bytField. But query finds spaces in the MyField.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Blanks (Access 2003/Windows XP)

    If you post a stripped down copy of your database, Loungers could investigate the problem directly. See <post#=401925>post 401925</post#> for instructions.

    Note: setting a field in a table to a space (or spaces) is tricky. When entering or editing data directly (manually), Access removes all trailing spaces. So if you have entered a space in a field using code, and if the user then accidentally edits that field, the space will be lost.

Posting Permissions

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