hamidreza.sajjadi
New member
- Local time
- Today, 23:09
- Joined
- Feb 19, 2024
- Messages
- 8
I have a data entry form in which there are two text boxes named "NameTxtBoxAt1" and "NamesTxtBoxAt2" . I have wrote a VBA code which gets value stored in them and then insert them into table "UnpivotedName" in column named "UserName" along side with constant value of "1403" in column Year. the problem arises when users decide to edit each single text box. consequently again two repetitive record (one for each text box) will be added to the UnpivotedName Table. here is my code in ms access 2021
how can i handle this problem?
+the aim of this procedure is to a kind of unpivoting data without UNION Query
Code:
Private Sub Command3_Click()
Dim RequiredQyrAt1 As String
Dim RequiredQyrAt2 As String
Dim NameValueAt1 As String
Dim NameValueAt2 As String
NameValueAt1 = Me![NameTxtBoxAt1].Value
NameValueAt2 = Me![NameTxtBoxAt2].Value
RequiredQyrAt1 = "INSERT INTO UnpivotedName (UserName,Year) VALUES ('" & NameValueAt1 & "','1403')"
RequiredQyrAt2 = "INSERT INTO UnpivotedName (UserName,Year) VALUES ('" & NameValueAt2 & "','1404')"
CurrentDb.Execute RequiredQyrAt1, dbFailOnError
CurrentDb.Execute RequiredQyrAt2, dbFailOnError
End Sub
how can i handle this problem?
+the aim of this procedure is to a kind of unpivoting data without UNION Query