pangeh@hotmail.co.uk
New member
- Local time
- Today, 19:33
- Joined
- Dec 7, 2009
- Messages
- 9
Hi,
I am using access 2003 and have a form which contains a subform showing a datasheet of a series of records.
The form is like a switchboard with buttons and when you select a certain record on the datasheet and press a button it will open up another form (to edit records, delete, view etc) but with that record selected.
Normally I have previously used vba in the onclick event on a button with code that does this and it alsways works but this time it doesn't.
My code is as below:
THe problem that is occurring is that when I press the button it asks for a parameter for Student_ID which is the control source on the edit record form I want to open. When I type one in it just opens up on the first record even if I put in a different student number.
I also tried using a static value in stlink criteria but got the same problem.
I used a msgbox to test that stlinkcriteria was actually picking up the right student id from the subform and it was. (i.e. it shows the correct student number of the record selected in the subform).
THe edit student record form has a query linking two tables for its data source. I can manually switch from record to record if I open the form separately and have no problem performing/saving edits.
Any assistance is greatly appreciated.
Many thanks
Pangeh
I am using access 2003 and have a form which contains a subform showing a datasheet of a series of records.
The form is like a switchboard with buttons and when you select a certain record on the datasheet and press a button it will open up another form (to edit records, delete, view etc) but with that record selected.
Normally I have previously used vba in the onclick event on a button with code that does this and it alsways works but this time it doesn't.
My code is as below:
Private Sub btn_edit_stdnt_recrd_Click()
Dim stdocname As String
Dim stlinkcriteria As String
stdocname = "frm_edit_Student_Record"
stlinkcriteria = "Student_ID = " & subfrm_student_records_tblview![Student ID]
DoCmd.OpenForm stdocname, , , stlinkcriteria
'MsgBox stlinkcriteria
End Sub
THe problem that is occurring is that when I press the button it asks for a parameter for Student_ID which is the control source on the edit record form I want to open. When I type one in it just opens up on the first record even if I put in a different student number.
I also tried using a static value in stlink criteria but got the same problem.
I used a msgbox to test that stlinkcriteria was actually picking up the right student id from the subform and it was. (i.e. it shows the correct student number of the record selected in the subform).
THe edit student record form has a query linking two tables for its data source. I can manually switch from record to record if I open the form separately and have no problem performing/saving edits.
Any assistance is greatly appreciated.
Many thanks
Pangeh