Results 1 to 7 of 7
  1. #1
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228

    Text field refuses to change programmatically


    For the life of me I cannot figure this one out. Based on a variable, a text field within a table is edited to one string or another.

    Code:
    with rs
      .Edit    
        If r = 0 Then
            ![Status] = "Recalled"
        Else
            ![Status] = "Complete"
        End If
      .Update
    end with
    It will edit to "Complete", but it refuses to go the other way. When r = 0 it will not revert from "Complete" to "Recalled".

  2. #2
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    rs looks like a recordset, not a text field.

  3. #3
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    It is, but the field ![Status] is a text field.

    I found where the error was occurring, it was later on following this section of code.

  4. #4
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    Yes, but that doesn't matter. You are using the "with" keyword. The ! in front of [Status] indicates that status is a field inside of the recordset.

    Change ![Status] to me.status.

    Also, .edit and .update means you are editing and updating the recordset with the data. It has nothing to do with the text box.

  5. #5
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    Text FIELD, as in a text field on a table.

  6. #6
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    Quote Originally Posted by kdbailey View Post
    Text FIELD, as in a text field on a table.
    Ahh, I gotcha. Sorry for the confusion.

  7. #7
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    Not a problem, I included "text field" for others to ensure that I wasn't trying to put text into a Number Field or something. I found the error, it had to do with situation recognition further down in the code. It was changing it, and then changing back based on other criteria.

    Problem is solved.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Where would you programmatically change a form's property?
    By Access_Novice in forum Programming
    Replies: 2
    Last Post: 12-30-2013, 09:14 PM
  2. How to change report to page 2 programmatically?
    By naeemahmad in forum Reports
    Replies: 23
    Last Post: 12-04-2013, 12:27 AM
  3. How to change query criteria programmatically
    By fekrinejat in forum Programming
    Replies: 2
    Last Post: 02-04-2013, 05:07 PM
  4. Programmatically change default switchboard at startup?
    By romeo_echo in forum Programming
    Replies: 4
    Last Post: 08-05-2011, 11:45 AM
  5. Change Row Background Color Programmatically
    By sales@4bco.com in forum Programming
    Replies: 2
    Last Post: 10-25-2009, 11:17 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