Not sure if anyone can help with this. It's hard to explain and doesn't really make sense. I have an Open form with various controls bound to a query.
On the Form there's a text box that lets me change the record source, and this all works as expected.
However, if I enter rubbish into the text box (or nothing) it should do nothing
Activate is not Form_Activate but my own procedure, (admitedly) badly named. But anyway I would expect nothing to happen if T isn't found in Dlookup.
But what it does is null out all the bound control, leaving only unbound ones populated.
I can't see why, or how and would like to know. If I step through the above code, as soon as it Ends the bound controls go, even though no other code seems to be running. In the debug window , at that point if I print the Forms record source it is still correct.
On the Form there's a text box that lets me change the record source, and this all works as expected.
However, if I enter rubbish into the text box (or nothing) it should do nothing
Code:
Private Sub Text309_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Dim T As String
T = Nz(Me.Text309.Text)
If Nz(DLookup("Prefix", "tblMain", "Prefix = '" & T & "'")) > "" Then
LocalPrefix = T
ImportedPrefix = ""
Form_frmShowRecord.Activate
End If
End If
End Sub
But what it does is null out all the bound control, leaving only unbound ones populated.
I can't see why, or how and would like to know. If I step through the above code, as soon as it Ends the bound controls go, even though no other code seems to be running. In the debug window , at that point if I print the Forms record source it is still correct.