Help:DLOOKUP in Unbound textbox (1 Viewer)

phatus

Registered User.
Local time
Yesterday, 22:03
Joined
Nov 10, 2010
Messages
100
good day this is my first time i will use dlookup function as suggested by one of the member here. i tried to search to my friend google.com about this function and i learn the syntax and apply it to my sample database. but im having problem in my criteria. attached here is my sample database and a detailed problem i encounter in my dlookup function...

dbase consist of 2 TABLE namely
tblrecord with the following field:fldschool, fldadrress, fldname and fldschlid
tblenrol with the following field: tblid,tblschool, tblgrade1, tblgrade2, tblgrade3 and tblgrade 4
QUERY: qryrecord and qryenrol same field as my table record and enrol
FORMS:frmrecord and frmenrol

as you can see the difference theres no name in my TABLE ENROL in my frmenrol i put a textbox and put in the unbound the dlookup function
the syntax is like this:
Code:
=DLookup ("fldname","tblenrol")
my problem is the schoolid must be equal to the name... what criteria can i put?
 

Attachments

  • Database21.accdb
    640 KB · Views: 254
  • Database21.mdb
    320 KB · Views: 186
Last edited:

phatus

Registered User.
Local time
Yesterday, 22:03
Joined
Nov 10, 2010
Messages
100
from http://www.mvps.org/access/general/gen0018.htm

Normal usage
For numerical values: DLookup("FieldName" , "TableName" , "Criteria = n") For strings: (note the apostrophe before and after the value) DLookup("FieldName" , "TableName" , "Criteria= 'string'") For dates: DLookup("FieldName" , "TableName" , "Criteria= #date#")
Refering to a form control
For numerical values: DLookup("FieldName", "TableName", "Criteria = " & forms!FormName!ControlName) For strings: (note the apostrophe before and after the value) DLookup("FieldName", "TableName", "Criteria = '" & forms!FormName!ControlName & "'") dates: DLookup("FieldName", "TableName", "Criteria = #" & forms!FormName!ControlName & "#")

my problem is the criteria what will i put... may be a example so that i can understand it well because i dont have any idea in dlookup sir.. this is my first time i used this Dlookup method...
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:03
Joined
Aug 30, 2003
Messages
36,140
Criteria would be the name of the field in your table that the value should be compared to.
 

phatus

Registered User.
Local time
Yesterday, 22:03
Joined
Nov 10, 2010
Messages
100
ok i try this
=DLookup ("fldname","tblenrol", "fldname=tblid)
and this
=DLookup ("fldname","tblenrol","tblid=fldname")

the effect is the School Head is now blank... i know something wrong with my criteria...
can you help me sir?
 

Users who are viewing this thread

Top Bottom