Wow it works now. I removed the With and End With and appeared another error saying the same with If. I added an additional 'End If' at the end (I'm not sure if it was necessary) and now it seems to work. The code ended up being this one:
Code:
Private Sub Company_Click()
If (IsNull(Me!Id)) Then
Beep
Else
If CurrentProject.AllForms("Company Detail").IsLoaded = False Then
' Form is closed
DoCmd.OpenForm "Company Detail", acNormal, "", "[Id]=" & Me!Id, , acDialog
Else
' Form is open
Forms![Company Detail].Filter = "id=" & Me!Id
Forms![Company Detail].FilterOn = True
Forms![Company Detail].Requery
End If
End If
End Sub
I'm really happy to have it working right now, I really appreciate your help so thank you so much.
As an additional thing, now that I have the events working, is there anyway to put the 'Company names' in the Subform inside 'Home' appear like an hyperlink? (Underlined, different color and that when you are on it the cursor changes)? Pretty much like it happens in Northwind sample database. I guess it might not be very difficult to do but I haven't find an effective way yet.
Thank you very much again.