Question about "text box" in forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form"Inspection Card" that populates a table "Inspection_Card". It
is filled out by an inspector. On the form I have or would like to have a
text box that would contain the X and Y Coordinate of the location that was
inspected. I have a linked table that has the X & Y Coords. The common link
between the two tables would be an Account No. I have been trying for days
to figure out how to use an "expression" to accomplish this. Is it possible?
And is it possible to have the X & Y Coords "pasted", into the
Inspection_Card table. Thnak you for help
 
Perhaps this article will give you a useful method, assuming that the
inspector selects the Account No. from a combo box on your form.
http://www.mvps.org/access/forms/frm0058.htm

If you already have the coordinates stored in a table, why do you need/want
to store them in a second table? A relational database is designed to have
data stored in one place, and then you get the data at a later time via
queries using joins between tables.
 
You will probably have to use VBA code to load the X & Y Coords into
the text box when the form loads. I would create a Private Sub maybe
called XYCoords to do this and then your Form_Load event would look
like this:

Private Sub Form_Load()
On Error GoTo ErrorHandler

Call XYCoords

End Sub

Private Sub XYCoords()
On Error GoTo ErrorHandler

'Place code here to open a recordset of your X & Y Coords and load them
into your text box

End Sub

Hope this helps!

Tammy
 
OK. How can I get the XY Coords from the table into the form? The inspector
types in the account no. We have over 29,000 account nos. We are just
beginning to tie all of our data together. I was hoping to be able to use an
"expression" and not VB code, as I don't know how to write the code.
 
Thanks for your reply. Right now I only know the very basics of Access. I
haven't had time to learn how to write VBA code.
 
It's generally not a good idea to allow a user to type in a critical value
that is used to link data. Instead, use a combo box that allows the user to
select from valid account numbers (in your case). If you do this, the
article whose link I posted shows how to get the data from the combo box's
Row Source query.

If you don't want to do this, then you'll need to use the DLookup function
in an expression as the control source of the textbox that is to display the
coordinates. See Help files for more information about DLookup.
 
Back
Top