how to get a field from other table in a form

  • Thread starter Surinder Kumar Arora ITS GM EAST MTNL Delhi
  • Start date
S

Surinder Kumar Arora ITS GM EAST MTNL Delhi

I have form 1 based on table 1 and form 2 based on table2. I want to have
field named details of table 2 to reflect in form 1 also. In form 1 design
view I create an unbound field and in control source I give expression
Table2![Details] . I get Name? in the new field when I open form 1.
What is wrong.
Regards
Arora SK
 
F

Fredg

=DlookUp("[Details]","table2","Where clause here if needed")
See the DLookUp() function in VBA help.
Also see
Where clause + Restrict data to a subset of records.
 
S

Surinder Kumar Arora ITS GM EAST MTNL Delhi

Dear Sir,
Thank You very much for the prompt reply.
The error Name? has disappered but it has not solved my problem fully. It
returns the same value for all records, While I want that it sould return
value corresponding to that record only. Each record is having a unique
primary key ID.
regards
arora sk
Fredg said:
=DlookUp("[Details]","table2","Where clause here if needed")
See the DLookUp() function in VBA help.
Also see
Where clause + Restrict data to a subset of records.


--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Surinder Kumar Arora ITS GM EAST MTNL Delhi said:
I have form 1 based on table 1 and form 2 based on table2. I want to have
field named details of table 2 to reflect in form 1 also. In form 1 design
view I create an unbound field and in control source I give expression
Table2![Details] . I get Name? in the new field when I open form 1.
What is wrong.
Regards
Arora SK
 
F

Fredg

Yes, of course.
That's why I said:
=DlookUp("[Details]","table2","Where clause here if needed")
See the DLookUp() function in VBA help.
Also see
Where clause + Restrict data to a subset of records.

You need to place a Where clause within the DLookUp to return the record
wanted.
Look in VBA Help.
Your situation is one that is answered.
Open any code window. Type
DLookUp
Place the cursor within the word.
Press F1

The Help file for DLookUp will appear.
Look at the examples given.

Your specific expression would be:
=DlookUp("[Details]","table2","[RecordID] = " & [RecordID])


If you are using Access 97, search Help files also for the
Where clause + Restrict data to a subset of records.
The clause is different for the various datatypes.

If you are using Access 2000 - 2002, I haven't a clue as
to where you will find that information, but I'm sure it's there...
someplace.

Then
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Surinder Kumar Arora ITS GM EAST MTNL Delhi said:
Dear Sir,
Thank You very much for the prompt reply.
The error Name? has disappered but it has not solved my problem fully. It
returns the same value for all records, While I want that it sould return
value corresponding to that record only. Each record is having a unique
primary key ID.
regards
arora sk
Fredg said:
=DlookUp("[Details]","table2","Where clause here if needed")
See the DLookUp() function in VBA help.
Also see
Where clause + Restrict data to a subset of records.


--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


message news:[email protected]...
I have form 1 based on table 1 and form 2 based on table2. I want to have
field named details of table 2 to reflect in form 1 also. In form 1 design
view I create an unbound field and in control source I give expression
Table2![Details] . I get Name? in the new field when I open form 1.
What is wrong.
Regards
Arora SK
 
S

Surinder Kumar Arora ITS GM EAST MTNL Delhi

Dear Sir,
Thank you very much for sorting out my problem.
Your suggestion worked fine
regards
arora sk
Fredg said:
Yes, of course.
That's why I said:
=DlookUp("[Details]","table2","Where clause here if needed")
See the DLookUp() function in VBA help.
Also see
Where clause + Restrict data to a subset of records.

You need to place a Where clause within the DLookUp to return the record
wanted.
Look in VBA Help.
Your situation is one that is answered.
Open any code window. Type
DLookUp
Place the cursor within the word.
Press F1

The Help file for DLookUp will appear.
Look at the examples given.

Your specific expression would be:
=DlookUp("[Details]","table2","[RecordID] = " & [RecordID])


If you are using Access 97, search Help files also for the
Where clause + Restrict data to a subset of records.
The clause is different for the various datatypes.

If you are using Access 2000 - 2002, I haven't a clue as
to where you will find that information, but I'm sure it's there...
someplace.

Then
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Surinder Kumar Arora ITS GM EAST MTNL Delhi said:
Dear Sir,
Thank You very much for the prompt reply.
The error Name? has disappered but it has not solved my problem fully. It
returns the same value for all records, While I want that it sould return
value corresponding to that record only. Each record is having a unique
primary key ID.
regards
arora sk
Fredg said:
=DlookUp("[Details]","table2","Where clause here if needed")
See the DLookUp() function in VBA help.
Also see
Where clause + Restrict data to a subset of records.


--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


in
message I have form 1 based on table 1 and form 2 based on table2. I want to have
field named details of table 2 to reflect in form 1 also. In form 1 design
view I create an unbound field and in control source I give expression
Table2![Details] . I get Name? in the new field when I open form 1.
What is wrong.
Regards
Arora SK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top