Code help

alliandrina

Registered User.
Local time
Today, 03:06
Joined
Mar 9, 2011
Messages
13
While working on ways to try simplify the tables of the database that I've been working on i found that I kept getting errors on this code

Private Sub Form_Load()
If Not Form.Recordset.EOF Then
txtStudentName.Value = DLookup("[firstname]", "tblTeacherpreSurvey", "[ID]= " + CStr(txtStudentID.Value)) & " " & DLookup("[Lastname]", "tblTeacherpreSurvey", "[ID]= " + CStr(txtStudentID.Value))
Else
txtStudentID.Value = Forms.frmPASATeacherPre.ID
[SchoolID] = Forms.frmPASATeacherPre.SchoolID
[TeacherID] = Forms.frmPASATeacherPre.TeacherID
txtStudentName.Value = DLookup("[firstname]", "tblTeacherpreSurvey", "[ID]= " + CStr(txtStudentID.Value)) & " " & DLookup("[Lastname]", "tblTeacherpreSurvey", "[ID]= " + CStr(txtStudentID.Value))
End If

txtSchool.Value = DLookup("[SchoolName]", "tblschools", "[ID] =" + CStr([SchoolID]))
txtTeacher.Value = DLookup("[Name]", "tblteachers", "[ID] =" + CStr([TeacherID]))
End Sub


It tells me that "You may have entered a comma without a preceding value or identifer"

I'm just a beginner. Vague idea of what it means and no idea of how to fix it. While waiting for a response, I will continue to look around and fiddle with the code.
 
Where is the error?

Put a few Message Boxes in with your code. If you get a correct result the that part of the code works.

Keep going till you get an error.
 

Users who are viewing this thread

Back
Top Bottom