By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,662 Members | 1,790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,662 IT Pros & Developers. It's quick & easy.

VBA code for selection form

P: 6
Hello,

I have made a main form and a sub form. When I click on the ms access standard form filter button I get an error message stating that I can not assign a value to this object. The subform is in datasheet view. What I programmed is that when you go to the next of previous row, some files on the main form are recalculated. But when I want to make a selecting by using the previously mentioned button I get errors. As you probably know some fields are being locked activating this button and greyed out.
Now I am searching for a solution. Should I not use the standard menu button in Access 2002? I can not control it. if you know which method I can use to activate the selection form in which I can enter my selection criteria for the filter to apply on the rows, i will be happy :-).

I hope someone recognize my problem and knows the solution, let me know.
Thanks in advance,
Kind regards,
Gerhard
Feb 23 '07 #1
Share this Question
Share on Google+
5 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Gerhard

Sorry but your question is confusing. Remember we can't see the database and know nothing about it. Read your question again and try posting a more detailed explanation of what you are currently doing, what you are trying to do and what is going wrong.

Mary
Feb 24 '07 #2

P: 6
Gerhard

Sorry but your question is confusing. Remember we can't see the database and know nothing about it. Read your question again and try posting a more detailed explanation of what you are currently doing, what you are trying to do and what is going wrong.

Mary
Hello Mary,

My database contains transactions which are show in the subform. When entering a new transaction the total turnover of the client to which the transaction applies, which is listed in the main form wil be changed. So when walking through the transactions lines of different customers, the turnover field content changes. But sometimes you want to filter on one customer. Or you want to check the turnover of an other client. For the latter I have 3 combo boxes in the main form so you can choose another client and transaction group then the client stated in the active transaction record in the subform. When I disable the Onfocus function to recaclated the turnover on the client field in the sub form the error does not occur when clicking on the standard form filter button in the ms access menu. But then I lose my recalculation function walking through the transaction lines.

I hope this makes some more clear for you,
thanks in advance again,
kind regards
gerhard
Feb 24 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
The best advice I can give is to apply the filter in code in the On Focus event before running the calculations.

Have a look at this tutorial to see how this can be done.

Example Filtering on a Form

Mary
Feb 24 '07 #4

P: 6
The best advice I can give is to apply the filter in code in the On Focus event before running the calculations.

Have a look at this tutorial to see how this can be done.

Example Filtering on a Form

Mary
Hello Mary,

Thanks for your answers. I am using the On focus event on the transaction row within the field client. When a client got focus I call a function to recalculate fields on the main form. But when you click on the standaard access form filter button, after which you can enter a criteria per field, I get the error about you can not assign a value to this object when calling the function which recalculates values for fields in the main form. But when I disable error handling by putting a ' before 'On Error GoTo Err_transactie within the recalculate values function I do not get a messge. But this is not the way to solve my problem. Do you know the right way?
Feb 25 '07 #5

NeoPa
Expert Mod 15k+
P: 31,271
Gerhard,
If you are getting an error on your form and you want help finding and fixing this error, you need to post the code where the error occurs and tell us which line it fails on.
Anything that is relevant (referred to by this line or previous lines if necessary) needs to be included also. We cannot tell you what's wrong with your code if we don't even see it.
Feb 26 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.