Reset a text field to NULL with VBA code
Thank you for taking the time to report an issue.
What's wrong... Please write below.
My table in its basic form has two fields.
Field A: Client
Field B: Quantity
The data is pulled from elsewhere in the database, but when it extracts it will have the client, and quantities. but some clients will have a Null quantity. e.g. below:
One thing is yes, the text field can be null, there won't always be a value.
I have tried this:
X field is defined as text, and populated with either null (no entry) or a text string.
Y field is defined as number and carries some number value.
Both X and Y are table entries.
Problem I have is that when X is null, I get the desired empty space, but when X is not null, I get #Error.
Which the makes
INSERT INTO ticketchanges VALUES (NULL,46,DEFAULT,'few af ae a',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,2);
The only thing I can think of is that I'm not declaring the column names because as you can see by the code, it's rather dynamic. So.
I have tried innumerable combinations of IIf, Is Not Null, Like using wildcards etc. For example IIf([Composer] is not null), "CA" (Suggested on an MS site) however I can't seem to find the right expression.
Heres the code im using and yet im getting Error 94 Invalid use of null
However, when this form is closed and reopened again, the field re-updates. How can I prevent this field from re-updating. Is there some sort of VBA code that I can enter that does thiswhen the form is loaded? Like, (if field null, then update)?
The text denoted in green I have added to add the CRD No. field to the table that is generated from this procedure - it is an unbound checkbox on the unbound form. However, I think I have missed something, because I get an error when I try to run the process.
This Macro runs against a Form that has a SubFrom (MainForm named "Expense ID" & SubForm, "Expense"). Macro is initiated by pressing a button.
I would like help with some VBA code showing how to perform the following:
1. Evaluate a field ("Activity") in the first record of Subform ("Expense") against condition "Is not Null".
2. If condition is true, set value of another field ("Post") in the same SubForm record to "1".
3. Move to next record and repeat steps 1 & 2 until all Subform records are evaluated.
4. Return to macro that initiated the VBA script to perform the next action in the macro.