Linking forms

C

CF

I have a form in which allows the user to make some
changes to an individual record like name, date, and
time. I now want to be able to allow them to change the
students attributes. So to do this I want to be able to
open the attribute form with the students information
already visble to allow the user to see and make necessary
changes. Now the attribute form is set to data entry and
needs to stay that way.

I tried to make the connection but I keep getting an error
missing operator. Any ideas? Also, do I need to do
something to the student attribute form to bring in on
their information onto the form? Thanks much appreciated


Private Sub chgAttr_Click()
On Error GoTo Err_chgAttr_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmStudentAttributes"
stLinkCriteria = "[txtStudentID]=" & me![txtStudentID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_chgAttr_Click:
Exit Sub

Err_chgAttr_Click:
MsgBox Err.Description
Resume Exit_chgAttr_Click

End Sub
 
G

Gerald Stanley

I suspect that the problem lies in the statement to set the
link criteria. The part preceeding the = sign must refer
to a columnn in the form's controlsource and I am guessing
that it should be
stLinkCriteria = "StudentID =" & me![txtStudentID]

This assumes that the student id is numeric. If it is
alpha, then it should be
stLinkCriteria = "StudentID = '" & me![txtStudentID] & "'"

Hope This Helps
Gerald Stanley MCSD
 
C

CF

Thanks Gerald that was the trick. Stupid little things
that can make you scratch your and ask why didn't I see
that.

Although, it allowed it to link and open the form. My
second question is how do I populate the form with the
students information if the form is set to data entry?
Also, do I look at manipualting the form on open or can I
pass some info through the link criteria?

Thanks again much appreciated
-----Original Message-----
I suspect that the problem lies in the statement to set the
link criteria. The part preceeding the = sign must refer
to a columnn in the form's controlsource and I am guessing
that it should be
stLinkCriteria = "StudentID =" & me![txtStudentID]

This assumes that the student id is numeric. If it is
alpha, then it should be
stLinkCriteria = "StudentID = '" & me![txtStudentID] & "'"

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have a form in which allows the user to make some
changes to an individual record like name, date, and
time. I now want to be able to allow them to change the
students attributes. So to do this I want to be able to
open the attribute form with the students information
already visble to allow the user to see and make necessary
changes. Now the attribute form is set to data entry and
needs to stay that way.

I tried to make the connection but I keep getting an error
missing operator. Any ideas? Also, do I need to do
something to the student attribute form to bring in on
their information onto the form? Thanks much appreciated


Private Sub chgAttr_Click()
On Error GoTo Err_chgAttr_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmStudentAttributes"
stLinkCriteria = "[txtStudentID]=" & me! [txtStudentID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_chgAttr_Click:
Exit Sub

Err_chgAttr_Click:
MsgBox Err.Description
Resume Exit_chgAttr_Click

End Sub
.
.
 

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