Insert query not working within procedure.

ahvc

Registered User.
Local time
Today, 20:54
Joined
Jun 17, 2002
Messages
41
Hello,

I used this query alone and it worked:
INSERT INTO MLog (member_id,service,month_year,units_qty) values("78","Quilt","01/2005",0)

I would like to use this within a procedure, something like this:

If condition then
insert record
endif

But Access does not seem to encourage this.

Can you please help me put the puzzle together.

Thanks much
AHVC
 
I am not sure what you are trying to do. Are you trying to run an SQL statment? Is the SQL statement the SQL statement from a saved query? Do you want to use variables in the Value section? If you have a saved query (best way to go) then:

If Condition Then
DoCmd.OpenQuery "MyQuery"
End if

Another way

Dim strSQL As String
strSQL = "INSERT INTO MLog (member_id,service,month_year,units_qty) values("78","Quilt","01/2005",0) "
If Condition THen
DoCmd.RunSQL strSQL
End If

Jack
 

Users who are viewing this thread

Back
Top Bottom