opening a form using data

G

Guest

Hello,
I have a form called Components which displays data from a table called Comps.
In this table there are students codes and their course codes. A student
can have more than one course code. I want to open another form that will
let me update other pieces of data based on the student and course.
I have used
stLinkCriteria = "[Person Code]=" & Me![Person Code]
but this just gives me all the courses for the selected student.
How can I just display the student and only 1 of their courses. I thought I
could add
& "[Course Code] =" &Me![Course Code]
but this doesn't work.

Any suggestions would be appreciated.

Rhys
 
D

Douglas J Steele

stLinkCriteria = "[Person Code]=" & Me![Person Code] & " AND [Course Code]
=" & Me![Course Code]

This assumes that both Person Code and Course Code are numeric fields. If
either are text, you need to include quotes. For instance, if Course Code is
text, you'd use:

stLinkCriteria = "[Person Code]=" & Me![Person Code] & " AND [Course Code]
='" & Me![Course Code] & "'"

(exagerated for clarity, the end of the string is = ' " & Me![Course Code] &
" ' " )
 
G

Guest

thanks very much. Greatly appreciated

Douglas J Steele said:
stLinkCriteria = "[Person Code]=" & Me![Person Code] & " AND [Course Code]
=" & Me![Course Code]

This assumes that both Person Code and Course Code are numeric fields. If
either are text, you need to include quotes. For instance, if Course Code is
text, you'd use:

stLinkCriteria = "[Person Code]=" & Me![Person Code] & " AND [Course Code]
='" & Me![Course Code] & "'"

(exagerated for clarity, the end of the string is = ' " & Me![Course Code] &
" ' " )


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


rhys said:
Hello,
I have a form called Components which displays data from a table called Comps.
In this table there are students codes and their course codes. A student
can have more than one course code. I want to open another form that will
let me update other pieces of data based on the student and course.
I have used
stLinkCriteria = "[Person Code]=" & Me![Person Code]
but this just gives me all the courses for the selected student.
How can I just display the student and only 1 of their courses. I thought I
could add
& "[Course Code] =" &Me![Course Code]
but this doesn't work.

Any suggestions would be appreciated.

Rhys
 

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

Top