How to get message if record not found

captgnvr

EAGER LEARNER
Local time
Today, 22:09
Joined
Apr 27, 2010
Messages
144
D/All

I managed to put combo box with names and got the macro to show records for the selected name.

Can any one tell me how to put a condition in this macro to get a message box to inform "the said name not found" .

brgds/captgnvr
 
You might have to use VBA for this one, macro's are very limited

If you can be a little more specific I can write up a code for you
 
D/Sam

I converted the macro to vb and the code is asf:

With CodeContextObject
DoCmd.GoToControl "N_CODE"
10 DoCmd.FindRecord .SEARCH_SALES, acEntire, False, , False, , True
DoCmd.GoToControl "[SEARCH_SALES]"
End With

What code to put after line 10 to get message box if the name is not found or if the record not found.
 
I don't get how the record can't be there if the combobox only shows the records that are there?

Am I missing something here?
 
D/SAM
The combo box has full list of names. But purchase made by the staff will be few. So I am making use of the same combo box to add if more staff purchase or use the same combo box to see a particular staff the amount of purchase he has made. I got it going thro VB but wanted to know if I could insert a condition in the macro to give a message that "there is no purchase made by this person".
 
Let's see if I get this right, you have a purchases form (continuous I assume) with a combo box on the side that lists out your entire staff. Once a certain staff member is selected, you want the form to filter out purchases made by that staff member only?

I am assuming a staff member can make more than a single purchase.
 
Yes. your understanding of my requirement is exact. So what I am trying is to get the data of purchases and total amount of the staff who made the purchase and at the same time by giving a command button can use the same combo box to use the new staff who will buy one item or more items. It will be much appreciated if u want to suggest some better way of doing this also.
 
I am having a hard time understanding your posts. Let's take things one by one shall we?

and total amount of the staff who made the purchase

Are you saying more than one staff member can make a single purchase?
confused2.gif
 
D/SAM
I got crew table, items table and purchase table which has the prime keys of items and name code for the staff. Using this I got a form and sub form like the ones in Northwind-orders or invoice sample.

What I am doing is adding one combo box with all crew names and using macro to find various purchase record and with text field to show the total purchase made for the selected person.

Additionally I want to use the same form if another staff purchases some items by using command button ("click to enter new staff purchase") which will give control to the combo box and after update to trigger the code to add the name selected and then enter the items purchased. Hope I am coming clear :)
 
If you want to use the same form to View Purchases already made or Add a New Purchase, all you need to do is change the Form Property from.

Listed in the Data Tab of the Form's Property you will see Allow Additions.

Have this set to No and add a button called "Add New Purchase" to the form.
Use vba code in the button OnClick event to change AllowAdditions = True.

I think it will be Me.AllowAdditions = True or something similar.
 
D/BILL
Thank you. Will keep this in mind. I was in control room to try out the program and bit disheartened. It worked fine from cabin. When I tried from control room comp, getting many errors like 'activex component cant create object'; 'ole is not registered'; 'cant create dao objects'. So again I am trying to read up to solve this. Btw, our company still using office97.
 
I made a sample for you, check the attached file and let me know what you need to modify :)
 

Attachments

D/SAM

It is very kind of u and thnks for the trouble u hv taken. With all the help, I hv completed the project and was unable to use it from networked comps. That is also solved after loading office 2003 also into the same system.

Mr. Bill -- pls accept my thanks and I am almost there now. Next phase will be to collect all the sales and monthly sales and stock month end etc.

This thread can be considered closed n as solved.

brgds/captgnvr
 

Users who are viewing this thread

Back
Top Bottom