R
rebelscum0000
Dear all,
I moved my code from my form to a module and now I have a mess that I
do not understand
I want to Search First into a Table called MyKeywords_Tbl If I already
had the entry
(Msg2) and the user will have to enter another entry,
If I don not have this entry in MyKeywords_Tbl then I will execute a
SQL
Statement in order to Insert Into MyKeywords_Tbl the new entry
The problem is when I tried to search using DLookup (MyReSeKeyword) I
get a
Run-Time Error '94'; Invalid use of Null
What I am doing wrong? Any Suggestions?
This is part of my entire code, the other part is still a mess
Option Compare Database
Sub MyKeyword_Appz_UIM()
Dim SQL3 As String, sQL4 As String, sQL5 As String 'Query,
Variables more strongly
Dim sQL6 As String, sQL7 As String 'Query,
Variables more strongly
Dim Msg As String, Style As String, Title As String
Dim Msg1 As String, Style1 As String, Title1 As String
Dim Msg2 As String, Style2 As String, Title2 As String
Dim Response As String, Response1 As String
Dim MySelection As String 'My Selection
Dim MyKeywordDe As String 'My Keyword Default
Dim MyKeywordDeCa As String 'My Keyword Default Capital
Dim MyCuKeywordID As String 'My Current Keyword ID
Dim MyReSeKeyword As String 'My Record Search Keyword
Dim MyAppzPlus As String 'My Appz Plus MyKeywordDeCa and "_Tbl"
Dim MyAppzDocuSetPlus As String 'My Appz Documents and Settings Plus
"DocuSet" & MyAppzPlus
'Make sure Microsoft DAO 3.6 Library in included in the References
'On Error GoTo ErrorHandling
'Initialize Variables
MyKeywordDe = Forms!MainExclude_Form!Keyword
'Converts The First Letter of the Entry in Capital
Forms!MainExclude_Form!Keyword = StrConv(MyKeywordDe, 3)
MyKeywordDeCa = Forms!MainExclude_Form!Keyword
Msg = _
"Are you Sure " & "[ " & MyKeywordDeCa & " ]" & " Will be your
Default search?"
Msg1 = _
MyKeywordDeCa & " is Now your Default Search"
Msg2 = _
"The Keyword: " & "[ " & MyKeywordDeCa & "]" & " Already
Exists, " & _
"Please Enter Another Keyword"
Msg3 = _
"User Cancel"
Style = _
vbYesNoCancel + vbQuestion 'Define buttons.
Style1 = _
vbYesNo + vbInformation 'Define buttons.
Style2 = _
vbOKOnly + vbInformation 'Define buttons.
Style3 = _
vbInformation 'Define buttons
Title = _
"Setting Keyword" 'Define title.
Title1 = _
"Keyword Set" 'Define title.
Title2 = _
"Keyword Duplicated" 'Define title.
Title3 = _
"Cancel Default Search" 'Define title.
Response = MsgBox(Msg, Style, Title)
If Response = 6 Then 'User chose Yes.
'MySelection = "Yes" 'Perform some action.
MsgBox Response & " = Yes"
if I have a Record equal to
'MyKeywordDeCa
MyReSeKeyword = _
DLookup("[MyKeyword]", "MyKeywords_Tbl", "[MyKeyword] = '" &
MyKeywordDeCa & "'")
End
Thanks in Advance
Kind Regards
Antonio Macias
I moved my code from my form to a module and now I have a mess that I
do not understand
I want to Search First into a Table called MyKeywords_Tbl If I already
had the entry
If I have them I want to inform the User the entry Already ExistsFrom Forms!MainExclude_Form!Keyword (MyKeywordDeCa),
(Msg2) and the user will have to enter another entry,
If I don not have this entry in MyKeywords_Tbl then I will execute a
SQL
Statement in order to Insert Into MyKeywords_Tbl the new entry
The problem is when I tried to search using DLookup (MyReSeKeyword) I
get a
Run-Time Error '94'; Invalid use of Null
What I am doing wrong? Any Suggestions?
This is part of my entire code, the other part is still a mess
Option Compare Database
Sub MyKeyword_Appz_UIM()
Dim SQL3 As String, sQL4 As String, sQL5 As String 'Query,
Variables more strongly
Dim sQL6 As String, sQL7 As String 'Query,
Variables more strongly
Dim Msg As String, Style As String, Title As String
Dim Msg1 As String, Style1 As String, Title1 As String
Dim Msg2 As String, Style2 As String, Title2 As String
Dim Response As String, Response1 As String
Dim MySelection As String 'My Selection
Dim MyKeywordDe As String 'My Keyword Default
Dim MyKeywordDeCa As String 'My Keyword Default Capital
Dim MyCuKeywordID As String 'My Current Keyword ID
Dim MyReSeKeyword As String 'My Record Search Keyword
Dim MyAppzPlus As String 'My Appz Plus MyKeywordDeCa and "_Tbl"
Dim MyAppzDocuSetPlus As String 'My Appz Documents and Settings Plus
"DocuSet" & MyAppzPlus
'Make sure Microsoft DAO 3.6 Library in included in the References
'On Error GoTo ErrorHandling
'Initialize Variables
MyKeywordDe = Forms!MainExclude_Form!Keyword
'Converts The First Letter of the Entry in Capital
Forms!MainExclude_Form!Keyword = StrConv(MyKeywordDe, 3)
MyKeywordDeCa = Forms!MainExclude_Form!Keyword
Msg = _
"Are you Sure " & "[ " & MyKeywordDeCa & " ]" & " Will be your
Default search?"
Msg1 = _
MyKeywordDeCa & " is Now your Default Search"
Msg2 = _
"The Keyword: " & "[ " & MyKeywordDeCa & "]" & " Already
Exists, " & _
"Please Enter Another Keyword"
Msg3 = _
"User Cancel"
Style = _
vbYesNoCancel + vbQuestion 'Define buttons.
Style1 = _
vbYesNo + vbInformation 'Define buttons.
Style2 = _
vbOKOnly + vbInformation 'Define buttons.
Style3 = _
vbInformation 'Define buttons
Title = _
"Setting Keyword" 'Define title.
Title1 = _
"Keyword Set" 'Define title.
Title2 = _
"Keyword Duplicated" 'Define title.
Title3 = _
"Cancel Default Search" 'Define title.
Response = MsgBox(Msg, Style, Title)
If Response = 6 Then 'User chose Yes.
'MySelection = "Yes" 'Perform some action.
MsgBox Response & " = Yes"
if I have a Record equal to
'MyKeywordDeCa
MyReSeKeyword = _
DLookup("[MyKeyword]", "MyKeywords_Tbl", "[MyKeyword] = '" &
MyKeywordDeCa & "'")
End
Thanks in Advance
Kind Regards
Antonio Macias