SQL

  • Thread starter Thread starter subs
  • Start date Start date
S

subs

i have a SQL query - i want the query to be executed but i donot want
the users to see the SQLstatement- is there anyway to do this
 
One option would be to execute the SQL statement in code, e.g. in a command
button's Click event procedure:

Using DAO:

    Dim dbs As DAO.Database
    Dim strSQL As String

    Set dbs = CurrentDb

    strSQL = "UPDATE Products  " & _
        "SET UnitPrice = UnitPrice * 1.1"

    dbs.Execute strSQL

or using ADO:

    Dim cmd As ADODB.Command
    Dim strSQL As String

    Set cmd = New ADODB.Command
    cmd.ActiveConnection = CurrentProject.Connection
    cmd.CommandType = adCmdText

    strSQL = "UPDATE Products  " & _
        "SET UnitPrice = UnitPrice * 1.1"

    cmd.CommandText = strSQL
    cmd.Execute

Ken Sheridan
Stafford, England

i am quite new to this- where would i find event procedure--- where
would i put my sql statement-- how should i go about doing this in
access thanks much
 
Back
Top