Copy first letter from one field to another in real time

  • Thread starter Thread starter markb
  • Start date Start date
M

markb

I have a field called Chemical Name in a chemicals field. I need to copy the
first letter of each entry in the chemical Name field to another field called
LocID. Those using this database do not have a full version of Access (only
Runtime 2007). Therefore, my understanding is that I cannot use a macro
correct?

Ultimately, I need to run a report on all fields meeting a certain criteria
organized by the first letter in the Chemical Name field.

Can someone please give me a step by step on how to make this work.

Thank you.
 
On Sat, 21 Mar 2009 16:24:01 -0700, markb

Incorrect. The runtime can use macros and VBA. But this issue only
requires an expression, not a macro. You can set the ControlSource of
LocID to:
=Left$(Me.myChemicalName, 1)
(replace myObjectNames with yours)

-Tom.
Microsoft Access MVP
 
Hi Tom,

that was very helpful. I was able to get my text box txtfrmLocID to
auto-populate with the first letter of the Chemical Name. The underlying
table (tblChemicalID.LocID field is now not being populated with the first
letter since the control source is now the formula and not the table field.

I am half way there. Please assist.

Thank you
 
You should not bother to store the first letter. You can always
calculate as it is needed using the expression in a query.
LEFT([ChemicalName],1)

Trying to store it in the table when you can calculate it takes up space
and is subject to error if someone figures out how to edit the table
directly - they have to make sure to edit both fields and not make a
typo when entering the value.


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Back
Top