captnk
01-07-2002, 01:57 PM
I am looking for a way that when i clik/or dblclik,on a field in a record (in a form/datasheet)it will delete the existing text and replace it with another "preset" text expression.
From that expression I also need it to delete or clear values from 1 or 2 other columns so that a recalculation can occur minus the item designated by the above situation.
Any ideas welcome
Captnk
wizcow
01-07-2002, 02:51 PM
In the field's properties in click or double click event, assign a macro.
build the macro using the 'setvalue' function.
Pat Hartman
01-07-2002, 05:56 PM
I would use the double click event as it is less likely to be fired accidentially and I would not use macros. There is no error checking available to you in a macro so they tend to make a database less robust than it would be if you stuck to VBA. In the double click event just place the statements you need.
If Me.SomeField = "SomeValue" Then
Me.SomeField = "SomeOtherValue"
End If
Me.AnotherField = Null
captnk
01-07-2002, 09:52 PM
Wizcow !!!
BRILLIANT !!!!
Many thanks works great.
Will have a look at Pat's view as well,its just so nice to be able to move on.
Actually I intend to save the changed/deleted items to a new temp table and the with the use of "if" statement be able to reverse the changes,with a similar procedure.
Again many thanks
Pat Hartman
01-08-2002, 05:16 AM
If you are not comfortable writing VBA code, create a macro that does what you want. Then convert the macro to code. I would actually use this method myself more frequently (lazy person that I am) but I find that the conversion of macros to VBA has not kept current with the versions of VBA and Microsoft's own recommended practices. But, converting the macros to inferior code is better in the long run than leaving them as macros. Besides, this is a useful way of teaching yourself VBA.
captnk
01-08-2002, 04:01 PM
PAT.
Thanks yr view and help.
I have just switched over from lotus approach,which despite all its bugs,was in many instances a bit more intuitive than access,so i'm struggling here,and all help is appreciated.
Yes I think yr right,I will ultimately have to put that in code,(its a bit unstable using the macro.)
As for my "bright idea" to be able to retore from a temp file using an if statement doesnt work from a Macro.
I can save the deleted item to a temp file,find it again in a query,but for whatever reason I cant put the found items back in the form.
(my form is a sub form,so their is no table to update or append to,but even so it wont update back to the main subformtable).
It really has got me stuffed as to why I cant put the found item back.
Any ideas pls.