Forms; Autonumber and number fields

G

Guest

I have this problem whereby I can't link an autonumber field from a form to
another form having a number field. Currently I have coded the codes below
for a String expression but I'm not sure on how to execute on autonumber and
number. Anyone can help?

Private Sub Findings_Click()
Dim strOpenArgs As String
Dim strCriteria As String
Dim strFormName As String
On Error GoTo Proc_Error
strFormName = "Findings"
strCriteria = "[CR Number] = '" & Me![CR Number] & "'"
strOpenArgs = Me![CR Number]
DoCmd.OpenForm strFormName, WhereCondition:=strCriteria, OpenArgs:=strOpenArgs
Proc_Exit: Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number & " in Findings_Click:" _
& vbCrLf & Err.Description
Resume Proc_Exit
End Sub
 
P

pietlinden

I have this problem whereby I can't link an autonumber field from a form to
another form having a number field. Currently I have coded the codes below
for a String expression but I'm not sure on how to execute on autonumber and
number. Anyone can help?

Private Sub Findings_Click()
Dim strOpenArgs As String
Dim strCriteria As String
Dim strFormName As String
On Error GoTo Proc_Error
strFormName = "Findings"
strCriteria = "[CR Number] = '" & Me![CR Number] & "'"
strOpenArgs = Me![CR Number]
DoCmd.OpenForm strFormName, WhereCondition:=strCriteria, OpenArgs:=strOpenArgs
Proc_Exit: Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number & " in Findings_Click:" _
& vbCrLf & Err.Description
Resume Proc_Exit
End Sub

You cannot create relationships and enforce referential integrity
(cascading updates/deletes) if you have data in the tables that
violate these rules. Either that or make the foreign key in the child
table a LONG, then you can create the relationship. You might need to
create a new DB, import the structure of all your tables, and then
create the relationships while they're empty. Then you can import all
the data afterward moving from parent table to child to grandchild...
 

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