Text Box

O

Olu Solaru

Is there a way to link a textbox control to a Autonumber field(ProcessID) in
a table.
Once I open the form I would like for the text Field to be automatically
populated with the corresponding data. Or should I use a Label Control
instead?
Either way, what steps can I take to get started?
 
M

Marshall Barton

Olu said:
Is there a way to link a textbox control to a Autonumber field(ProcessID) in
a table.
Once I open the form I would like for the text Field to be automatically
populated with the corresponding data. Or should I use a Label Control
instead?
Either way, what steps can I take to get started?


If the form is bound to the table, just use a bound text
box.

If the form is not bound to that table, we will need more
information about where the number comes from and how you
are identifying the record that contains the number you
want.
 
E

e.mel.net

Olu said:
Is there a way to link a textbox control to a Autonumber field(ProcessID) in
a table.
Once I open the form I would like for the text Field to be automatically
populated with the corresponding data. Or should I use a Label Control
instead?
Either way, what steps can I take to get started?


yes,
just set the textbox's control source property to 'ProcessID' just like
any other field. When the user starts to type data into a new record a
number will automatically be assigned.
I usually make the textbox disabled - so it's there, but doesnt draw
attention to itself, and users dont expect to be able to change it.
 
O

Olu Solaru

The form is not bound.
The process Id number comes from this table;

tblLotNumber tblTraining
------------- ---------------
LotNumber(PK) EmpID
Sop1 LotNumber
Sop2 SopNumber
Sop3 ProcessID
ProcessID

I am using a form - frmLotNumber. I will like for the field to
automatically populate in a text box if possible , I just read that you can't
use labels to retreive information from fields, or expressions.

My reason for all this work is that I am running a query that will give me
employees who have trained on SOp1 through Sop3, each will be represented per
training event in the tblTraining table in the SopNumber.

My current query basically pulls :
LotNumber, SopNumber, Emp ID ,
where tblLotNumber. LotNumber= tblTraining.LotNumber

.. However my boss prefers that I use another criteria besides LotNumber,
for Security Purposes.

So I created another field ProcessID(AutoNumber) in both tables, and I want
to use this has my new query criteria. hope all this makes sense.
 
M

Marshall Barton

Since the ProcessID in the training table is a foreign key
it can not be an autonumber. Assuming I just misinterpreted
what you were saying, use the same query you were using
before but substute ProcessID fo LotNumber.

Notes: Make certain that the ProcessID field in the lot
number table has a UNIQUE index.

You probably should also remove the LotNumber field from the
training table.

Your query is valid but archaic in Jet (Access) databases.
An INNER JOIN is the recommended way to do it:
SELECT tblLotNumber.LotNumber,
tblTraining.SopNumber,
tblTraining.[Emp ID]
FROM tblLotNumber INNER JOIN tblTraining
ON tblLotNumber.ProcessID = tblTraining.ProcessID
WHERE tblLotNumber.ProcessID = [Enter Process ID]
 
Top