OpenForm Question

calvinle

Registered User.
Local time
Today, 02:00
Joined
Sep 26, 2014
Messages
332
Hi,

I am wondering why the use of DoCmd with Where condition does not work, unless I add Datamod to it, then it will work?

If I use the code below to open a form from a subform, it will not take me to the student id as per sWhereClause:
Code:
   sWhereClause = "[student_id] = """ & Me.student_id & """"
  DoCmd.OpenForm "frmStudent", , , sWhereClause, , acWindowNormal

If I use the code below, it does take me to the student id as per sWhereClause:
Code:
   sWhereClause = "[student_id] = """ & Me.student_id & """"
  DoCmd.OpenForm "frmStudent", , , sWhereClause, acFormReadOnly, acWindowNormal

Anyone know why?

Thanks
 
If [student_id] is a number field type, then you only need one ".
Code:
   sWhereClause = "[student_id] = " & Me.student_id
 
No its not a number field but text field. Mix number and letter.
 
I'm curious. What happens if you change acFormReadOnly to acFormEdit, acFormAdd or acFormPropertySettings?
 
I'm curious. What happens if you change acFormReadOnly to acFormEdit, acFormAdd or acFormPropertySettings?

acFormEdit will take to the record. Not Add for sure, not Property either..
 
Oh no, I was just wondering why with ac will take me to record and without doesnt..

More a learning than a solving problem in my question.
 

Users who are viewing this thread

Back
Top Bottom