using this WHERE CONDITION HOW do populate the textbox

R

Ron

I am opening another form based on this where condition

DoCmd.OpenForm "frmpayments", , ,
"txtstudentid=forms![subfees1]![studentaccountid]"

I want to open frmpayments, an unbound form I want the txtstudentid
textbox on my frmPayments form, it is an unbound textbox I want that
textbox to be populated with the ID that is in studentaccountid in
SUBFEES1.

The form opens but the txtstudentid is not populated, how would I
populate it?

thanks
 
G

Guest

The WhereCondition parameter has the effect of setting a where clause on the
data in the form you're opening. It will not set control values. You could do
it with an extra line of code:
DoCmd.OpenForm "frmPayments"
Forms!frmPayments.txtStudentId = Me.StudentAccountId

The will probably work, however in general it's best to avoid coupling forms
like this where one form is affecting a control on another. A better approach
would be to pass the studentId in the OpenArgs parameter like this:
DoCmd.OpenForm FormName:="frmPayments", OpenArgs:=Me.studentAccountId

Then in the OnOpen event of the payments form, put:
Me.txtStudentId = Me.OpenArgs

bARRY
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top