G
Guest
Hey all,
I'm trying to avoid double appending to a table.
I have macro that runs an update query to a table tbl_PBT. Before the macro
runs I wanted to check to see if the values on the userform match the values
on the appending table, if they do I want to exit the sub.
I need to write this check in the code before the docmd for the macro on the
userform_input.
I think what I need to do is an If And statement of somekind.. I'm having
trouble with the syntax.
private sub Append_Click()
If tbl_pbt!company=me!company and
if tbl_pbt!year=me!year and
if tbl_pbt!period=me!period then
exit sub
end if
docmd.runmacro "mcr_append"
end sub
I'm trying to avoid double appending to a table.
I have macro that runs an update query to a table tbl_PBT. Before the macro
runs I wanted to check to see if the values on the userform match the values
on the appending table, if they do I want to exit the sub.
I need to write this check in the code before the docmd for the macro on the
userform_input.
I think what I need to do is an If And statement of somekind.. I'm having
trouble with the syntax.
private sub Append_Click()
If tbl_pbt!company=me!company and
if tbl_pbt!year=me!year and
if tbl_pbt!period=me!period then
exit sub
end if
docmd.runmacro "mcr_append"
end sub