0

I am new to access VBA.

I am trying to add 1 to all numbers in a field that are equal or greater than the value in text box [TP_Bld_OrderNum_Txt].

This is my code:

CurrentDb.Execute "UPDATE TP_Matrix " & _
      "SET TP_Matrix.Order_" & Me.TP_Bld_TP_Cbo & " = TP_Matrix.Order_" & Me.TP_Bld_TP_Cbo & "+1 " & _
      "WHERE TP_Matrix.Order_" & Me.TP_Bld_TP_Cbo & ">= Me.TP_Bld_OrderNum_Txt"

I get this error:

too few parameters expected 1

I believe it relates to the text box value.

If I replace Me.TP_Bld_OrderNum_Txt with a number, the query works fine.

I have the text box set up as a number.

Why doesn't it recognize its value?

0

1 Answer 1

2

You provided Me.TP_Bld_OrderNum_Txt as a literal (as a fixed string) and not its value:
& ">= Me.TP_Bld_OrderNum_Txt"

Try this instead:
& " >= " & Me.TP_Bld_OrderNum_Txt.Value

Also, it is a good practice to use .Value to explicitely use the value of the control.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.