Visual Basic 6 Problem in Table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lightroses
    New Member
    • Feb 2013
    • 16

    Visual Basic 6 Problem in Table

    Hi to all.. I was working for now in our project in vb6.
    But I have a problem when i run the save button, the message box appeared and says"no values in required parameters."

    my code is below:

    Code:
    Tsql = "UPDATE Tbl_Tithes SET Label11.Caption = '" & Me.txtTithes.Text & " ' where ID LIKE '%" & txtID.Text & "%'"
     
       Call dbConnect
          TConn.Execute Tsql
        TConn.Close
        Set TConn = Nothing
        Unload Me
    I knew that the conflict code i have do is in the label11.caption . I use label11.caption because it contains the date that the user will input on the form and save in access. I dont know what to do, someone help me to fixed this problem.
    Last edited by Rabbit; Feb 6 '13, 05:17 PM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    The syntax for a simple update statement is this:
    Code:
    UPDATE tableName
    SET tableName.fieldName = someValue
    Do you see the problem?

    You're trying to update a field named Caption in a table named Label1. You probably have neither. You need to change that to the actual name of the field you want to update.

    Comment

    • lightroses
      New Member
      • Feb 2013
      • 16

      #3
      Thank you so much for your reply I appreciated it so much.

      I don’t know on how to update the fieldname in the table that declared in label11.caption ..

      I want to work this code when the user input the date in the combo boxes then it pass the value to the label11.caption . The Date input by the user is the field name in the table. There is many Fields inside the table containing different dates. It depends on the user on what date he wants to update. After that the user will input the ID of the member and the value of the Tithes then when he clicks the save button, the records will saved in the TithesDB.

      I dont know on how to code this so I attached my complete program here. Please check this and inform me what is wrong from my codes.. Thanks in advance.Always Tke Cre and God bless you
      Last edited by lightroses; Feb 7 '13, 02:05 AM.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        In that case, concatenate it the same way you're doing to Me.txtTithes.Te xt.

        As a rule of thumb, I don't download files from strangers.

        Comment

        • lightroses
          New Member
          • Feb 2013
          • 16

          #5
          :-) I think i need to search further. Its hard to explain.. Thanks a lot!

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            I know what you're trying to do. All I'm saying is that you already have the solution. You're already dynamically supplying a value in your existing code, you just need to do it again.

            Comment

            • lightroses
              New Member
              • Feb 2013
              • 16

              #7
              how can i do it again. can you give me a sample code?

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                You do realize the code you posted is itself sample code of how to concatenate a value?

                I'm not sure why you don't understand since you already wrote code that uses the solution I'm suggesting. What you need is this:
                Code:
                Tsql = "UPDATE Tbl_Tithes SET " & Label11.Caption & " = '" & Me.txtTithes.Text & " ' where ID LIKE '%" & txtID.Text & "%'"

                Comment

                • lightroses
                  New Member
                  • Feb 2013
                  • 16

                  #9
                  Hello Rabbit!! I try to run your given code. And you know what its works great. My codes is running smoothly. I am very grateful for your help.Thanks a lot for your Understanding.m ore power. God Bless you ('_')

                  Comment

                  Working...