Hello
Please advise how to set a textbox to description of a field? and update it as the focus move from one field to another ?
Thanks
Hello
Please advise how to set a textbox to description of a field? and update it as the focus move from one field to another ?
Thanks
Possibly code in each control's GotFocus event that sets value of Description textbox.
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.
Are you talking about the field description in the table design?
if so the code in the got focus event would be something like
Txtdesc=tabledefs(“mytable”).fields(thiscontrol.co ntrolsource).description
you haven’t provided any names so substitute with your names
Thank you for replying . I tried but I am a beginner with Access and was unable to get it running.
Properties of table is attached.
Properties of form is attached.
I used BuildEvent to make some changes but its giving error. Please advise.
Thanks
I missed currentdb - and you don't have the rest quite right
text39=currentdb.tabledefs(“mytable”).fields(thiscontrol.controlsource).description
the code needs to go into each of the other controls got focus event, not text39
thiscontrol is the name of the control that the code is in
for future reference, when posting code, please copy/paste it and use the code tags to preserve formatting (highlight the pasted code and click the # button)
and for your table/field design it is a bad idea to have spaces and non alpha numeric characters in their names (e.g. Last Name, Zip/Postcode). Leaving them in can cause some weird errors - even if you surround with square brackets. Can virtually guarantee if you don't fix this, every time you post a question you will be told again.
Also recommend you get into the habit of giving controls meaningful names. Typically a textbox wouldhave a txt prefix, combo, cbo, list lst etc. eg txtFldDesc instrext of Text39
Thanks noted ..
I am still getting error, please advise .
attached error2.png and vbacode.png
I missed currentdb - and you don't have the rest quite right
text39=currentdb.tabledefs(“mytable”).fields(thiscontrol.controlsource).description
the code needs to go into each of the other controls got focus event, not text39
thiscontrol is the name of the control that the code is in
for future reference, when posting code, please copy/paste it and use the code tags to preserve formatting (highlight the pasted code and click the # button)
and for your table/field design it is a bad idea to have spaces and non alpha numeric characters in their names (e.g. Last Name, Zip/Postcode). Leaving them in can cause some weird errors - even if you surround with square brackets. Can virtually guarantee if you don't fix this, every time you post a question you will be told again.
Also recommend you get into the habit of giving controls meaningful names. Typically a textbox wouldhave a txt prefix, combo, cbo, list lst etc. eg txtFldDesc instrext of Text39
Your table name is not "myTable" perhaps??
EDIT - nor is your control name "thiscontrol"?
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
As CJ already instructed, change the generic "mytable" and "thiscontrol" to your actual object names.
You will often see generic aliases in sample code because we don't know your object names.
Last edited by June7; 02-01-2023 at 08:37 PM.
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.