Results 1 to 7 of 7
  1. #1
    bbeernaert is offline Novice
    Windows XP Access 2000
    Join Date
    Aug 2010
    Location
    Belgium
    Posts
    11

    if right form = abc then set abc in the record

    Hello

    Code:
    If Right(Machine, 4) = "nota" Or Right(Machine, 4) = "pers" Then
                    planset!tekst = Right(Machine, 4)
                End If
    this code does not seem to work, can anyone tell me what's wrong??

  2. #2
    bbeernaert is offline Novice
    Windows XP Access 2000
    Join Date
    Aug 2010
    Location
    Belgium
    Posts
    11
    Ok I added a few things

    and the and not function does not work...

    anyone any help thx!!:


    Code:
    If Right(Machine, 4) = "nota" And Not Left(Machine, 4) = "nota" Or Right(Machine, 4) = "pers" And Not Left(Machine, 4) = "pers" Then
                planset![Machine] = Right(Machine, 4)
                End If

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by bbeernaert View Post
    Hello

    Code:
    If Right(Machine, 4) = "nota" Or Right(Machine, 4) = "pers" Then
                    planset!tekst = Right(Machine, 4)
                End If
    this code does not seem to work, can anyone tell me what's wrong??
    there is nothing wrong with the syntax. the middle line suggests an update to a table field. if it's not working then the recordset code is in error somewhere in the module, which you have not included here.

  4. #4
    bbeernaert is offline Novice
    Windows XP Access 2000
    Join Date
    Aug 2010
    Location
    Belgium
    Posts
    11
    Quote Originally Posted by ajetrumpet View Post
    there is nothing wrong with the syntax. the middle line suggests an update to a table field. if it's not working then the recordset code is in error somewhere in the module, which you have not included here.

    The first code is working but this one

    Code:
    If Right(Machine, 4) = "nota" And Not Left(Machine, 4) = "nota" Or Right(Machine, 4) = "pers" And Not Left(Machine, 4) = "pers" Then
                planset![Machine] = Right(Machine, 4)
                End If

    does not seem to work. I get no errors

  5. #5
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    How does not it work? Would please give more details? for example, give what data you had in Machine, what do you expected and what did you get?

    AND, I think Left(Machine, 4) <> "nota" is easier to read than Not Left(Machine, 4) = "nota"
    ?

  6. #6
    bbeernaert is offline Novice
    Windows XP Access 2000
    Join Date
    Aug 2010
    Location
    Belgium
    Posts
    11
    The data in machine is HLnota or HL123nota for example,

    I want vba to put "nota" there as tekst instead of HLnota or HL123nota for example. But If the data in Machine is already "nota" I want that this command does not execute???

  7. #7
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    As what ajetrumpet said, you need to check in other code relative to your recordset.

    Please note that you need post update to a recordset to save change to table, an example:

    MyRecordset.edit
    myRecordset!fieldname="abcdefg"
    myRecordset.update

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

Similar Threads

  1. Replies: 63
    Last Post: 01-25-2013, 05:20 AM
  2. Replies: 6
    Last Post: 07-19-2010, 10:57 AM
  3. Replies: 0
    Last Post: 05-04-2010, 06:39 AM
  4. Replies: 3
    Last Post: 06-27-2009, 03:53 PM
  5. Replies: 9
    Last Post: 03-24-2009, 09:19 PM

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