EdFred
knows enough, dangerous
- Local time
- Today, 10:55
- Joined
- Mar 2, 2007
- Messages
- 129
So, I did a search on here and found what *should* work but does not.
First - the code
strCustWebID is a public string, so it sticks around after the function is done, also why I run the = "" at the beginning.
If step through the code and ?strCustWebID in the debug screen it returns what it should.
If I ?GetCustID in debug it returns nothing.
If I ?GetCustID and then ?strCustWebID the appropriate value is returned so the function seems to be working.
But of course when I place GetCustID() in the criteria of the query (because I can't put a string in the criteria) I get an empty query.
Other functions return appropriate values in the debug screen and queries, so it just seems to be this function.
I know it has to be something that I am just overlooking - but I'm apparently blind.
First - the code
Code:
Public Function GetCustID() As String
strCustWebID = ""
If CurrentProject.AllForms("Customer History Form").IsLoaded Then
strCustWebID = [Forms]![Customer History Form]![Customer ID]
Else
If CurrentProject.AllForms("Invoice").IsLoaded Then
strCustWebID = [Forms]![Invoice]![Customer ID]
End If
End If
End Function
If step through the code and ?strCustWebID in the debug screen it returns what it should.
If I ?GetCustID in debug it returns nothing.
If I ?GetCustID and then ?strCustWebID the appropriate value is returned so the function seems to be working.
But of course when I place GetCustID() in the criteria of the query (because I can't put a string in the criteria) I get an empty query.
Other functions return appropriate values in the debug screen and queries, so it just seems to be this function.
I know it has to be something that I am just overlooking - but I'm apparently blind.