Hi ppl
the foll: code calls a query that inserts the data into a table through
parameters...
is my sql statement correct... My table is created in design view....
Private Sub Command4_Click
On Error GoTo Err_Command4_Click
Dim count As Integer
Dim qd As QueryDef
Dim strsql As String
strsql = "select nz(max(asset_id),0)+ 1" & "from asset"
Set qd = CurrentDb.QueryDefs("add")
qd.Parameters("parFld1") = strsql
qd.Parameters("parFld2") = Text2
qd.Execute
DoCmd.Close
stDocName = "asset_INFORMATION"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command4_Click:
Exit Sub
Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub
my query is :
insert into asset (asset_id,asset_level)
values (parfld1,parfld2)
plz help....
salad - 28 Aug 2006 11:45 GMT
> Hi ppl
>
[quoted text clipped - 35 lines]
>
> plz help....
Is there a reason you are making strSQL a parameter? WHen will you
assign the qd's SQL a value?
Reiro - 28 Aug 2006 13:08 GMT
hi ... i came up with a solution... i took out the sqlstr and my
insert sataement now looks like this...
insert into asset(asset_id,asset_level)
select nz(max(asset_id),0) + 1,parfld2
from asset;
it works fine.....