Attach this code to an event on your form. Note- change the blue to match the names in your db. I only included 2 fields in the example. If you can not get it to work please provide more info on datatypes and indexes...
CurrentDb.Execute ("UPDATE TableName SET FieldName1 = Null, FieldName2 = Null WHERE textFieldName '" & Me.textControlName & "'"
Thanks this will help a great deal, I am however having difficulty identifying the specific names of the "textFieldName" and the "textControlName". What part of the form/table are these?
textControlName is the name of the control on the form and textFieldName is the name of the field that control is bound to. Note- the example I provided will only work for one field if your table is using more than one field as a key you will need to change the code. So if you have a table like so...
textFieldName intFieldName
data1 1
data2 2
Then you'll be ok. But if your table is like so...
Thanks so much for working me through this one. I will try to work it out and let you know how it goes. I need to have this working by tomarrow so..thanks!
I still can not identify the "textFieldName" and the "textControlName" names. Arn't I already using the FeildName in the first part of the code?
There is a "field name", and there is a "control name".
You may have a field named, "MyFieldOne". When you drag the text box control to the design view of the form, Access will assign it a "control name", like "text1" or something close. This is not the same thing as a "field name".
You can rename the control name (e.g., "txtMyFieldOne" in Properties>Other. I have a lot of controls with the generic name provided by Access. I also have some controls with names identical to the field names they represent...this is supposed to be troublesome, I'm not sure why...
With apologies to Pezamystik, I am
Gus Brunston An old PICKer, using Access2000
padregus@attbi.com
Well I am lost here. I have no idea how to gleen the required names out of all this. Does anyone have any suggestions?
I have to clear the feilds with the following name characteristics:
Control source: comdate1 (to 7)
Feild name: (properties other name) comdate1 (to7)
Table name: QMEinfo
I apparently require an additional name?
I also need to clear 2 other fields, also in a series of 1-7.
I get a syntax error still. I thnk the problem lies with the fact that I am using a date time picker to fill the feild. It is returning a full date and full time. The error is a missing operator error.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.