Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WhereCondition of the Open Form method of DoCmd [wink] 2

Status
Not open for further replies.

multipleintell

Technical User
Dec 7, 2001
72
US
I must be missing something...

I have a form where teachers verify info about themselves, i.e. building code and extension. This form is "frmVerify". They press an "OK" button on this form which loads a new form based on their grade level. A first grade teacher will open the frmGrade1 and a second grade teacher frmGrade2 and so on. I want that form to open to the TeacherCode of the same teacher in the verify form...the problem is...it doesn't work. How am I flubbing this WhereCondition? Is there a better way of doing this? Should I be doing this in the filter condition instead? Doesn't seem to work either way...it brings all 155 teacher up in frmGrade# anyway.

Here is my code....

Private Sub CommandOK_Click()
Dim strForm As String
strForm = "frmVerify"
Select Case cboGrade
Case Is = "K"
DoCmd.OpenForm "frmGradeK", , , [TeacherCode] = Forms![frmVerify]![TeacherCode_v]
DoCmd.Close acForm, strForm
Case Is = "1"
DoCmd.OpenForm "frmGrade1", , , [TeacherCode] = Forms![frmVerify]![TeacherCode_v]
DoCmd.Close acForm, strForm
Case Is = "2"
DoCmd.OpenForm "frmGrade2", , , [TeacherCode] = Forms![frmVerify]![TeacherCode_v]
DoCmd.Close acForm, strForm
Case Is = "3"
DoCmd.OpenForm "frmGrade3", , , [TeacherCode] = Forms![frmVerify]![TeacherCode_v]
DoCmd.Close acForm, strForm
Case Is = "4"
DoCmd.OpenForm "frmGrade4", , , [TeacherCode] = Forms![frmVerify]![TeacherCode_v]
DoCmd.Close acForm, strForm
Case Is = "5"
DoCmd.OpenForm "frmGrade5", , , [TeacherCode] = Forms![frmVerify]![TeacherCode_v]
Case Else
MsgBox "Please select a grade"
Exit Sub
End Select
End Sub
 
Did you place the Where condition in quotes?
if not try it...
Code:
DoCmd.OpenForm "frmGrade5", , , "[TeacherCode] = Forms![frmVerify]![TeacherCode_v]"
________
George, M
 
Did you place the Where condition in quotes?
Try this way...
Code:
DoCmd.OpenForm "frmGrade5", , , "[TeacherCode] =" & Forms![frmVerify]![TeacherCode_v]
________
George, M
 
shaddow,

You are wonderful. You have saved me from a major headache. I can't believe something as little as a quotation mark was all I needed! Wow!

Melissa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top