Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

How to fill data from another table to a form - URGENT

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ljubo lecic - 11 Mar 2005 00:54 GMT
I have the simple continuous form with several fields.
When entering data I want to fill some of my fields with data from another
table based on the value entered in
my first field "FIELD1"
I want to do something like this:"
select Column_x into My_Field_in_my_form
from Table_x
where table_X.id = Forms!My_Form!FIELD1"
This is probably incorrect in ACCESS but it shows what i need.
I am New in ACCESS ! THANKS in advance!
Dirk Goldgar - 11 Mar 2005 01:10 GMT
> I have the simple continuous form with several fields.
> When entering data I want to fill some of my fields with data from
[quoted text clipped - 6 lines]
>  This is probably incorrect in ACCESS but it shows what i need.
> I am New in ACCESS ! THANKS in advance!

There are two ways to do this, depending on your situation.  The
simplest way, if it works for you, is to base the form, not just on the
first table, but on a query that joins the two tables on the linking
field.  It has to be an outer join, so that all records from the first
table are included, even if they don't have FIELD1 filled in yet, or if
that field doesn't have a matching record in Table_X.

So, for example, you form might be based on a query with SQL along these
lines:

   SELECT
       Table_A.FIELD1,
       Table_A.FIELD2,
       Table_A.FIELD3,
       Table_X.Column_X
   FROM
       Table_A LEFT JOIN Table_X
           ON Table_A.FIELD1 = Table_X.ID;

This sort of thing is sometimes called an "auto-lookup" query.  As soon
as FIELD1 is filled in, the matching information is pulled in from
Table_X.

A different approach is to use a calculated control with a DLookup
function expression as its ControlSource.  But that won't be as
efficient, and I'd recommend using it only if the auto-lookup query
doesn't work for some reason.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.