Hi,
I have two forms:
frmsites = Main form
frmlog = other form
I have a button located on "frmsites" to open "frmlog". The code behind the button is as follows:
The tbls are linked as follows:
tblsites = PK sitesid
tbllog = PK logid, FK sitesid
Now when I open the "frmlog" in the field named logid it is an autonumber. The sitesid field displays the site number that appeared on the form I have just navigated away from namely "frmsites".
So this all works well.
The issue I have is when I want to move through the existing entries within "frmlog" it displays other siteid's as well when it should be locked only to the queries generated on the siteid I navigated away from.
For example:
frmsites - sitesid = 1121
open frmlog - displays logid = 15 and displays sitesid = 1121
start clicking through the records and the sitesid number changes to others that are in the database.
Pulling my hair out
Can anyone help?
I have two forms:
frmsites = Main form
frmlog = other form
I have a button located on "frmsites" to open "frmlog". The code behind the button is as follows:
Code:
Private Sub new_query_Click()
If intAccessLevel < 3 Then
MsgBox "You do not have access rights to create a new query", vbExclamation + vbOKOnly, "Acces Denied"
Exit Sub
End If
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmlog"
DoCmd.OpenForm stDocName, , , , acFormEdit
Forms![frmlog]![sitesid] = Forms![frmsites]![sitesid]
DoCmd.Close acForm, "frmsites", acSaveYes
End Sub
The tbls are linked as follows:
tblsites = PK sitesid
tbllog = PK logid, FK sitesid
Now when I open the "frmlog" in the field named logid it is an autonumber. The sitesid field displays the site number that appeared on the form I have just navigated away from namely "frmsites".
So this all works well.
The issue I have is when I want to move through the existing entries within "frmlog" it displays other siteid's as well when it should be locked only to the queries generated on the siteid I navigated away from.
For example:
frmsites - sitesid = 1121
open frmlog - displays logid = 15 and displays sitesid = 1121
start clicking through the records and the sitesid number changes to others that are in the database.
Pulling my hair out