Ben_Entrew
Registered User.
- Local time
- Today, 02:56
- Joined
- Dec 3, 2013
- Messages
- 177
Hi all,
I want to change certain records of a query or table.
Here I tried to change this in a query. Something is missing in my code.
Can someone help me out ?
Thanks in advance.
Regards,
Ben
I want to change certain records of a query or table.
Here I tried to change this in a query. Something is missing in my code.
Can someone help me out ?
Thanks in advance.
Regards,
Ben
Code:
Public Sub TNS_QUERY()
Dim strSQL As String
Dim x As Double
Dim qdf As QueryDef
strSQL = "SELECT TEST_TNS.[TestID],TEST_TNS.[Division],TEST_TNS.[Customer_Split],SUM([TOTAL_NET_SALES]) as [TNS] " & _
" FROM TEST_TNS " & _
" GROUP BY TEST_TNS.TestID,TEST_TNS.[Division],TEST_TNS.[Customer_Split]"
With CurrentDb
Set qdf = CurrentDb.CreateQueryDef("TNS_QUERY", strSQL)
.Close
End With
Select Case TNS_QUERY.TestID
Case TNS_QUERY.TestID = "Common"
x = TNS_QUERY.[TNS]
Case TNS_QUERY.TestID = "AK"
TNS_QUERY.[TNS] = TNS_QUERY.[TNS] + (x / 2)
Case TNS_QUERY.TestID = "MC"
TNS_QUERY.[TNS] = TNS_QUERY.[TNS] + (x / 2)
End Select
End Sub