G
Guest
I have a form known as "relations" and a form known as "data_entry".
data_entry's primary key is known as "ID", and has a bunch of other fields.
relations is based on a different table and only has 3 fields: The Primary
key, "current" and "related".
What I would like to do is for a given record in data_entry, pull up
"relations", but only show the records that has the data in the "current"
field match what's in the "ID" field of the data_entry form. The idea behind
this is that if there are issues connected to a given record in data_entry, I
would like to be able to store other "ID" numbers so that the users know
where to go for more information.
I have posted what I have below, but I keep getting a "2501 error". Any idea
why this is?
Thanks!
Private Sub Command200_Click() 'This is the relations button
Dim holdval As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check if new
MsgBox "The record must be saved before relations are allowed"
Else
holdval = "[current] = " & Me.[ID]
DoCmd.OpenForm "relations", acNormal, , holdval
End If
End Sub
data_entry's primary key is known as "ID", and has a bunch of other fields.
relations is based on a different table and only has 3 fields: The Primary
key, "current" and "related".
What I would like to do is for a given record in data_entry, pull up
"relations", but only show the records that has the data in the "current"
field match what's in the "ID" field of the data_entry form. The idea behind
this is that if there are issues connected to a given record in data_entry, I
would like to be able to store other "ID" numbers so that the users know
where to go for more information.
I have posted what I have below, but I keep getting a "2501 error". Any idea
why this is?
Thanks!
Private Sub Command200_Click() 'This is the relations button
Dim holdval As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check if new
MsgBox "The record must be saved before relations are allowed"
Else
holdval = "[current] = " & Me.[ID]
DoCmd.OpenForm "relations", acNormal, , holdval
End If
End Sub