code for the combo box if there's no record found it will display msgbox to no record

juniepiper27

Registered User.
Local time
Today, 11:07
Joined
Sep 24, 2014
Messages
49
Dear Sir,

Good Day!

I have a problem with my database I have a combo box that will search for my record. Actually its working I input the specific number it goes to the specific record. But I want, if there no existing record in my database it will display a Messagebox that "No record Found" I try to put a code in a macro builder in a after update property field but nothing happened.

please help me to give a expression code that it will display the msgbox if there's no record found.

the given code from macro builder is attached. I try to have an if else statement but I dont know how to not equal that giver conditional expression.

waiting for your response..

thanks,
 

Attachments

  • given code from macro builder.jpg
    given code from macro builder.jpg
    60.1 KB · Views: 150
Can you give me the code for that... ? Please....

thanks :)
 
and also it will not affect the search for my record.. because that code I will input to the combo box that will search my record..

thanks,
 
Can you give me the code for that... ? Please....

thanks :)
Something like the below, (not tested). Remember to insert your table name and maybe remove the two single quotes.
Code:
If DCount("*", "YourTableName", "[Empno]=" & "'" & [Screen].[ActiveControl] & "'")=0 Then
 
Sir,

The Expression code you give me was wrong.. it mentioning "The expression you entered contain invalid syntax"
 
and sir, I want that if there's no record found in the search using combo box... there's a msgbox that will display... "No Record found in your search"

waiting for your response...

Thanks,
 
Sir,

The Expression code you give me was wrong.. it mentioning "The expression you entered contain invalid syntax"
Show how you inserted in your macro!
Did you try what I mention "Remember to insert your table name and maybe remove the two single quotes."
 
Sir,

Please dont angry with me.. First the combo box is connected to the field in the query not in the table. I try to use your given function to me via expression builder this is what I Input....

[FONT=&quot]If DCount("*", "[vehcleinfoquery]", "[asstnumbr]=" & "'" & [Screen].[ActiveControl] & "'")=0 Then[/FONT]


and also this.
If DCount("*", [vehcleinfoquery], [asstnumbr]= & "'" & [Screen].[ActiveControl] & "'")=0 Then
[FONT=&quot][/FONT]
[FONT=&quot]but still the syntax is error. I input it via expression code and also in macro builder via SearchForRecord in afterupdate property field.I both do that but its still wrong... please give the sample of access database from table to the form so I can copy what you did..[/FONT]

[FONT=&quot][/FONT]
[FONT=&quot]Thanks so much....
[/FONT]

[FONT=&quot][/FONT]
 
this is the given code from macro when I used the combobox for search..

-afterupdate property field
-SearchForRecord Action
where condition = ="[asstnumbr] = " & "'" & [Screen].[ActiveControl] & "'"

that's is working whenever I select the assetnumber and I input the specific assetnumber it will change & goes to the correct record. but I want if I input the assetnumber which is not listed in the record. there's a msgbox will come out that no record found in your search..

That's why I try this code but still wrong...

IIf([asstnumbr]<>"'" & [Screen].[ActiveControl] & "'",MsgBox("NO RECORD FOUND IN YOUR SEARCH"))

please... give the correct code please... thank you so much....
 
First I'm not angry with you, why should I be that?
please... give the correct code please... thank you so much....
I have given you the right code, the problem I think is, you don't know how to use it.
Show as you did in your first post a printscreen from you macro where you have insert my code.
 

Users who are viewing this thread

Back
Top Bottom