The rationale for not using spaces in object names is that the Access Gnomes have no way to know that Last Name is a single object. In code you can work around this, by surrounding the name in Square Brackets, as you've done here, but sooner or later you'll forget to do this and spend time trying to figure out why your code is bombing...it's just easier to simply not use spaces. Everyone has their own preferences, here, but an Underscore
Last_Name
or CamelBack formatting
LastName
are the most common.
Your statement
Originally Posted by
ndehhh
I now have this problem where DLookup only autofills the details for Student ID 1, no matter what Student ID I input into the form
makes me wonder about the Datatype of Student_ID. You syntax is correct if the Datatype is a Number, but if Student_ID is defined as Text, it would have to be
Code:
[Last Name] = DLookup("[Last Name]", "Students", "Student_ID = '" & Me.Student_ID & "'")
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007