replace table value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amraam35
    New Member
    • Jul 2006
    • 6

    #1

    replace table value

    heres the situation. I have a table in access with some fields, 1 2 and 3. I have a form that i want you to enter text in a box, and for that text to replace a certain value in field 1.

    Is there a script that can do this, or a command? I am so stuck on this.

    I can call up the value that i want, and enter the new value, i just cant get them to swap.

    thanks alot

    Bill
  • BSOB
    New Member
    • Jul 2006
    • 77

    #2
    that last word "swap" might be leading me down the wrong path, but it sounds like you want the text box to become the value, and the value to become the textbox at the same time. (i could be competely wrong but...)

    try using a 3rd variable:
    temperary variable = textbox
    textbox = value
    value = temperary variable

    swapped?

    Comment

    • Mahesh_Bote
      New Member
      • Jul 2006
      • 26

      #3
      do u want to update or insert these values in access?

      Comment

      • amraam35
        New Member
        • Jul 2006
        • 6

        #4
        Hi

        Thank you very much for the replys. I dont think i made my question very clear. I have a table with three fields. User ID, User Name, and Password.

        I have a form called "ChangePassword ", where you can change the old password into a new one. You enter the User Name and password, and a then a new password that you want to change the old one into. If the user name and old password match, then the program continues and allows you to change passwords.

        It works up to there. I cannot figure out how to get the visual basic to take the "old password" from the table, and replace it with the "New password" which was entered in the form, but has yet to be saved to a table or anything. I dont want to replace the username or ID, just swap passwords.

        Is there a function that will do this?

        say, declare the table password,

        then declare the form entry (new password),

        then replace the table password value with the new password value?

        Comment

        • Mahesh_Bote
          New Member
          • Jul 2006
          • 26

          #5
          don't confuse ur self according to OLD and NEW password. What u have to do is, just update the New password in table i.e.

          Update <Table Name> Set Old_Password_Fi eld = New_Password_Fi eld Where Old_Password_Fi eld = <Old Password>

          ,after checking the username and old password, to confirm the modification. Means u have to just update the table in case of changing the password. just consider the old password as current password.

          hopes u got the idea !!! :) :) :)
          Mahesh

          Comment

          • amraam35
            New Member
            • Jul 2006
            • 6

            #6
            Mahesh_Bote,

            Thank-you so much for your help, that was exactly what i was looking for.

            Comment

            • amraam35
              New Member
              • Jul 2006
              • 6

              #7
              ok,

              Update tblEmployees
              Set strEmpPassword = Me.NewPass
              Where strEmpPassword = Me.OldPass.Valu e

              that is what i entered in my VB.

              strEmpPassword is the field in the employees table
              OldPass is the name of the textbox in the form where the old password is entered,
              likewise for the new password


              when i run the code, it comes up with "Compile error, sub or function not recognized" and highlights the word <Update> in my code

              any thoughts?

              Comment

              Working...