Sabotage1945
Registered User.
- Local time
- Yesterday, 19:35
- Joined
- Sep 30, 2004
- Messages
- 17
Hi everyone,
I'm having problems figuring out what to do...
Background:
I've got a form called 'frmDirectory' which has a directory of students, I would like to link this with my 'frmStudents' where I can then display and edit the fields. FYI: The 'frmStudents' is using a query called 'qryStudentVisit' (a combination of 3 tables). I can add/edit the contents in my 'frmStudents' form normally.
So far 'frmDirectory' is working well, except I would like to press a button to "edit" the entry in the 'frmDirectory' and be taken to the 'frmStudents'. The code I have (and it seems to be failing me) is:
This last 'orange' part is what VBA is complaining about. I don't understand why, and no one can seem to help me
The error I get in the "MS Visual Basic" dialog is:
I'm assuming the [PersonID] I'm referrencing here is for each of the forms. I have a PersonID in frmDirectory and also a PersonID in the frmStudents. Could it be that I'm referencing something that I'm not supposed to in the 'frmStudents' form? FYI: I have the following in that form (its working fine inside that form)...
In the VBA code I've tried:
as well as...
In my 'frmDirectory' I have [PersonID] as the item listed, and which I'm trying to link with in 'frmStudents'.
That didn't work either. I'm not sure which I should reference to get this to work.
The [PersonID] is a number (Long Integer) field stored in my 'tblStudents', and is also the Primary Key. I'm calling everything in the forms through a query vs the table.
Could the call I'm using to open the 'frmStudents' form to the appropriate [PersonID] be the wrong type of VBA code? I'm so new at this I'm not sure what I'm doing. All I want to do is have a command button open the coresponding student form based on his/her [PersonID].
When I Google'd this error I got this info, which says that this problem is by design:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;197952
I don't think I understand this last part - how do I go about doing that? Can anyone help me?
Cheers,
Sab.
I'm having problems figuring out what to do...
Background:
I've got a form called 'frmDirectory' which has a directory of students, I would like to link this with my 'frmStudents' where I can then display and edit the fields. FYI: The 'frmStudents' is using a query called 'qryStudentVisit' (a combination of 3 tables). I can add/edit the contents in my 'frmStudents' form normally.
So far 'frmDirectory' is working well, except I would like to press a button to "edit" the entry in the 'frmDirectory' and be taken to the 'frmStudents'. The code I have (and it seems to be failing me) is:
Code:
Private Sub cmdStudentForm_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmStudents"
stLinkCriteria = "[PersonID]=" & Me![PersonID]
[COLOR=Orange][B]DoCmd.OpenForm stDocName, , , stLinkCriteria[/B][/COLOR]
End Sub
This last 'orange' part is what VBA is complaining about. I don't understand why, and no one can seem to help me

The error I get in the "MS Visual Basic" dialog is:
Run-time error '3008':
The table 'tblStudents' is already opened exclusively by another user, or it is already open through the user interface and cannot be manipulated programmatically.
[End], [Debug], [Help]
I'm assuming the [PersonID] I'm referrencing here is for each of the forms. I have a PersonID in frmDirectory and also a PersonID in the frmStudents. Could it be that I'm referencing something that I'm not supposed to in the 'frmStudents' form? FYI: I have the following in that form (its working fine inside that form)...
Control Name: txtPersonID
Control Source: PersonID
Control Source: PersonID
In the VBA code I've tried:
Code:
stLinkCriteria = "[PersonID]=" & Me![PersonID]
Code:
stLinkCriteria = "[txtPersonID]=" & Me![PersonID]
That didn't work either. I'm not sure which I should reference to get this to work.
The [PersonID] is a number (Long Integer) field stored in my 'tblStudents', and is also the Primary Key. I'm calling everything in the forms through a query vs the table.
Could the call I'm using to open the 'frmStudents' form to the appropriate [PersonID] be the wrong type of VBA code? I'm so new at this I'm not sure what I'm doing. All I want to do is have a command button open the coresponding student form based on his/her [PersonID].
When I Google'd this error I got this info, which says that this problem is by design:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;197952
"The key is to separate the offending code from the form, put it into it's own module, and call the module..."
I don't think I understand this last part - how do I go about doing that? Can anyone help me?
Cheers,
Sab.