I would like to add a value to a field on a form based on a button on that same form. Anyone know how to do this?
Any help appreciated!
Thanks in advance!
I would like to add a value to a field on a form based on a button on that same form. Anyone know how to do this?
Any help appreciated!
Thanks in advance!
Is this a textbox bound to field of form's RecordSource? Is this field empty at the time of click?
Maybe simply in the button's Click event:
If IsNull(Me!fieldname) Then Me!fieldname = some value
Why do you need to do this?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks! I'm a newbie on access. Actually found a way to do it. On the click event of the button, I just added "fieldName.Value=ValueName" which worked fine.
I need to do this to be able to show on another form only records based on this value. Is there a better way of doing this? Thanks for your help.
Depends.
Is the textbox actually bound to a field of form's RecordSource. If yes, then you are actually changing the value in the table. Is this your intent?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
The example MyTestForm.zip at this thread might be useful.
https://www.accessforums.net/forms/fo...xes-18492.html
In the simplest case, using VBA to work the forms is overkill. However, open Frm1 and try clicking on the listboxes, and look the VBA for both Frm1 and Frm2.