Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query related to runsql not working in 2002

Status
Not open for further replies.

vinanti

Programmer
Mar 7, 2003
26
IN
hi,

i have a form with a cancel button on it;when clicked on this button i want the record from the base table to be deleted which has been half entered by the user on this form.
this functionality was working very fine when i was working in ms access-97 but since i have now upgraded to access-2002 i see that this command does not work at all
could naybody tell me where am i wrong?

my command line is:
docmd.runsql "Delete * from mast where id=Forms!mast!ID"

here id is the name of the field in the base table;
and i want to delete the record based on the forms!mast!ID value which is a control on the loaded form.

i have always been provided very nice help from this site; and so hop for the same this time too.


plz reply...


vinanti
 
hi daniel,

i tried this but the problem is that the record is still not deleted it says "0 records deleted ...."
and ultimately when i check the base table i find the record available i dont understand why it is happening so,in ms-access 97 it was absolutely fine!

plz suggest some way out...
it is very important my application was almost done but for this i have to postpone my submission.

thnks in advance ,
vinanti
 
"which has been half entered by the user on this form."

That record does NOT yet exist in the table (it has to be saved), so 0 records deleted is true.
To abort changes, you don't have to run any SQL... just
Me.Undo
will do the trick.


And I truely believe Access 97 had the same behaviour, unless you had saved the record:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunSQL blah blah blah..


HTH




[pipe]
Daniel Vlas
Systems Consultant

 
hey,

thnks
it worked...what i had to do is place the code in the form upadate event rather than at the previous place because it was deleting it before adding and saving it at the time of update...

anyways very happy that it has got solved...

but daniel i have one more query:i want to know if there is a mouse over event for a combo box or a command button in access 2002 like in flash or many other programming languages?

plz help...


thnks again...
bye,
vinanti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top