Run-time error 3075 - Is there Something Wrong? (1 Viewer)

Ashfaque

Student
Local time
Today, 19:20
Joined
Sep 6, 2004
Messages
894
I am trying to overwrite unbound text box data to a temporary tbl with below code but it produces subjected runtime error 3075.

Code:
strSQL = "UPDATE T_ATemp set [ExistingTotSaudis] = '" & Me!OverAllSaudis & "', [ExistingTotExpats]= '" & Me!OverAllExpats & "', [NewSaudiAddition]= '" & Me!TxtNewSaudiPerc & "', [NewExpatAddtion]='" & (Me!NewExpatPerc) & "');"

Out of 4 unbound text boxes 2 of them contains integer value and other 2 has percentage that is calculating from different process. Please see the attached.

Any idea
 

Attachments

  • Error.jpg
    Error.jpg
    16 KB · Views: 294

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 13:50
Joined
Jul 9, 2003
Messages
16,244
Usually means you got to many, or to few, parentheses. ..
 

moke123

AWF VIP
Local time
Today, 09:50
Joined
Jan 11, 2013
Messages
3,849
Not sure of your datatypes so I can't comment on your delimiting.

You have 3 parenthesis which are probably not needed.
Code:
(Me!NewExpatPerc) & "');"
 

Ashfaque

Student
Local time
Today, 19:20
Joined
Sep 6, 2004
Messages
894
Datatype is number with 2 decimals.
Code:
Dim strSQL As String
strSQL = ("DELETE * FROM T_ATEMP")
DoCmd.RunSQL strSQL
strSQL = ("UPDATE T_ATemp set [ExistingTotSaudis] = " & Me!OverAllSaudis & ", [ExistingTotExpats]= " & Me!OverAllExpats & ", [NewSaudiAddition]= " & Me!TxtNewSaudiPerc & ", [NewExpatAddtion]=" & NewExpatPerc)
DoCmd.RunSQL strSQL

I just want to delete previous record and update with new one that generated in textboxes.

I tried with above but still same error.:oops:
 

Ashfaque

Student
Local time
Today, 19:20
Joined
Sep 6, 2004
Messages
894
Now no error in below code
Code:
strSQL = "UPDATE T_ATemp set [ExistingTotSaudis] = " & Me!OverAllSaudis & ", [ExistingTotExpats]= " & Me!OverAllExpats & ", [NewSaudiAddition]= " & Me!TxtNewSaudiPerc & ", [NewExpatAddtion]=" & NewExpatPerc

But displays You are about Update (0) rows where as there is new values in unbound text boxes.
 

Minty

AWF VIP
Local time
Today, 13:50
Joined
Jul 26, 2013
Messages
10,354
You can't update a non-existent record.
You need to insert a new one!
 

moke123

AWF VIP
Local time
Today, 09:50
Joined
Jan 11, 2013
Messages
3,849
You didn't include the delete portion of your code in the original post which in this case is an important omission.
It's always best to include the complete code.
 

Users who are viewing this thread

Top Bottom