Such an easy problem I think, but I can't get it. I have this in my VBA for the form_current:
Not sure if my syntax is correct here:
Wish I could change that space but I can't.
The problem that I am getting is that when the form loads up to insert a new record, it doesn't recognize that "assigned to" is blank, and so triggers an error when it tries to do the dlookup.
I even tried an on error goto to run the code to set the rowSourceType and RowSource, but it seems to ignore this altogether.
Last note: Everything worked fine before I split the db. Now that it is split, I am coming up with the error on the dlookup. Any ideas?
Code:
Dim varArchive1
If IsNull("Me.Assigned To.Value") Then
varArchive1 = 0
Else
varArchive1 = DLookup("[archive]", "Contacts", "[ID]= " & [Forms]![Task Details]![Assigned To])
End If
If varArchive1 = -1 Then
[Forms]![Task Details]![Assigned To].RowSourceType = "Table/Query"
[Forms]![Task Details]![Assigned To].RowSource = "qryAllContacts"
Else
[Forms]![Task Details]![Assigned To].RowSourceType = "Table/Query"
[Forms]![Task Details]![Assigned To].RowSource = "qryLimitedContacts"
End If
End Sub
Code:
If IsNull("Me.Assigned To.Value") Then
The problem that I am getting is that when the form loads up to insert a new record, it doesn't recognize that "assigned to" is blank, and so triggers an error when it tries to do the dlookup.
I even tried an on error goto to run the code to set the rowSourceType and RowSource, but it seems to ignore this altogether.
Last note: Everything worked fine before I split the db. Now that it is split, I am coming up with the error on the dlookup. Any ideas?