SQL statement in a form

A

Ana

Hi,

In a form I have a Combo1 field which provides Agent_Id and Agent_Name from
Table1.

Then I have Date_In and Date_Out fields which are chosen from a calendar.

I would like a command button to execute the following SQL statement:



UPDATE dbo.Table1
SET COMMISIONS_LIQ = '1'
WHERE (AGENT_ID = Combo1) AND (COMMISIONS_LIQ = 0) AND
(DATE_START BETWEEN Date_In AND Date_Out)



Howto?

TIA

Ana
 
S

smk23

Ana, are you asking how to execute SQL from within MS Access? If so try this:

Dim strSQL As String

strSQL = "UPDATE dbo.Table1" & _
" SET COMMISIONS_LIQ = '1' " & _
" WHERE (AGENT_ID = Combo1) AND (COMMISIONS_LIQ = 0) AND" & _
" (DATE_START BETWEEN Date_In AND Date_Out)"

DoCmd.RunSQL strSQL

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top