How to disable Record buttons New (blank) record?

tihmir

Registered User.
Local time
Today, 07:45
Joined
May 1, 2018
Messages
257
Hi all,
I have Filter combo box FormA with subformB.
The VBA code I use for combo box is After Update even: Me.Requery
The subform is with RecordSorce with SQL:
SELECT qry_ОtherАctivities .*, *
FROM qry_ОtherАctivities
WHERE (((qry_ОtherАctivities .Emploee)=[Forms]![fm_Object]![fm_ОtherАctivitie]![cbo_Emploee]));
It is works well, but I want to disable Record buttons New (blank) record, because if pressed I can not add new activity - The form ask for Emploee
If I set on Property sheet on the Form Allows Aditions to "No", all Grids on the form is gone (hide) before I choose combo box Emploee
 

Attachments

Last edited:
Use VBA to change combobox RowSource. Use form Current event as well as cbo_Emploee AfterUpdate event. Cascading combobox is common topic and there are many code examples.
 
Hi. I don't understand your question, and I think there is something wrong with your demo. Have you tried it? What are we supposed to do with it? Where is the problem?
 
Hi. I don't understand your question, and I think there is something wrong with your demo. Have you tried it? What are we supposed to do with it? Where is the problem?
Hi, theDBguy. As I said I need to disable Record button New (blank) record on Navigation buttons on the form
Use VBA to change combobox RowSource. Use form Current event as well as cbo_Emploee AfterUpdate event. Cascading combobox is common topic and there are many code examples.
June7, could you please give me a little more description
 
Last edited:
Hi, theDBguy. As I said I need to disable Record button New (blank) record on Navigation buttons on the form
Hi. There are two forms in your demo. Which form are we talking about? Looking at the code you posted above, I don't even see a fm_Object in your demo.
 
Hi. There are two forms in your demo. Which form are we talking about? Looking at the code you posted above, I don't even see a fm_Object in your demo.
I am talking about fm_Activity
Уou don't even see a fm_Object in my demo because I did this demo for a minute so I could describe what I was talking about.
 
I am talking about fm_Activity
Уou don't even see a fm_Object in my demo because I did this demo for a minute so I could describe what I was talking about.
Okay, so when I try to open fm_Activity, I get the following prompt:

Forms!frm_Activity!cbo_Employee

What am I supposed to enter there?
 
Okay, so when I try to open fm_Activity, I get the following prompt:
Forms!frm_Activity!cbo_Employee
What am I supposed to enter there?
Would you try to open now the DB, please?
 
@theDBguy, did you see post 2? I think it is cascading combobox with dynamic parameter causing this popup prompt.
@June7. You could be right, but did you try to open the posted demo? I couldn't even open the form without getting the prompt, so I can't really check if it's about a cascading combo or not.

@tihmir. Did you see Post #2 and tried it?
 
Would you try to open now the DB, please?
I guess that means you updated it. I redownloaded the demo, and now the form opens to a blank form. The "new" button on the Navigation Button is disabled. So, I guess that's what you wanted, right? What else is the problem now?

Edit: Oops, I take that back. When I first opened the form, I didn't get a prompt. But when I enabled the content, to allow code to run, now I get the prompt back when I try to open the form. So, my problem is the same. What did you try to change?
 
No, I had not yet downloaded and opened file. I thought error was due to cascading combobox and that is not the case I see now on rereading OP.

I never use dynamic parameterized queries or SQL statements. I would remove WHERE clause from RecordSource SQL and just use VBA to apply filter to form. Review http://allenbrowne.com/ser-62.html
 
OK, What I need to do is to create a form with cobobox to Filter data in query. when I load the form in want to be blank form. When I choose an Еmployee in the combobox I need to load all records for this Еmployee
No, I had not yet downloaded and opened file. I thought error was due to cascading combobox and that is not the case I see now on rereading OP.
I never use dynamic parameterized queries or SQL statements. I would remove WHERE clause from RecordSource SQL and just use VBA to apply filter to form. Review http://allenbrowne.com/ser-62.html
I'll look at that and try to figure it out. Thanks
 
Should be saving EmployeeID into tbl_Activities, not their name.

I would normally load all records then apply filter after user makes selection in combobox. Some prefer to change RecordSource property. I am not quite sure how to force form to open with empty dataset (other than setting DataEntry Yes), never done that.

I see no need to reference in SQL a query object that does not do any calculations or filtering, just reference table.
SELECT tbl_Activities.* FROM tbl_Activities;

If you want records associated with employee selected from unbound combobox, do you really want to have a bound combobox that allows them to change employee in activity record?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom