I borrowed one of the forms from the MS Access Solutions database and
altered it to fit my needs. The form was the 'EditProducts' form where you
select a category from a combo which then populates another combo for
products. Then when you select a product, the form displays the info for it.
Everything is working well except, with the original, when the form is
opened, the focus is on the SelectCategory combo box, while the form
elements are greyed out until you select a category and product. When I open
my form, the main form is active, and the focus is on one of those controls.
Once I select an item from the first combo box in the header, then the form
controls grey out until I select a option from the second combo. I am at my
wits end trying to figure out what I've missed. I've posed the code for the
form below.
Option Compare Database
Option Explicit
Private Sub Form_AfterUpdat e()
' Requery SelectProduct combo box.
Me!SelectProjec t.Requery
End Sub
Private Sub SelectClient_Af terUpdate()
' Enable and requery SelectProduct combo box.
' Disable controls in detail section.
Me!SelectProjec t.Enabled = True
Me!SelectProjec t.Requery
EnableControls Me, acDetail, False
End Sub
Private Sub SelectProject_A fterUpdate()
' Find record for product selected in SelectProduct combo box.
' Enable controls in detail section and disable ProductID text box.
' Go to SupplierID combo box.
DoCmd.ApplyFilt er , "ProjectID = Forms!frmWorksh eet!SelectProje ct"
EnableControls Me, acDetail, True
Me!ProjectID.En abled = False
Me!ProjectLocat ion.SetFocus
End Sub
Private Sub SelectProject_B eforeUpdate(Can cel As Integer)
If IsNull([SelectProject]) Then
MsgBox "You must select a project."
Cancel = True
End If
End Sub 1 2195
In the Load event procedure of the form, SetFocus to the combo, and call the
code tha disables the contorls in the Detail section:
Me.SelectProjec t.SetFocus
EnableControls Me, acDetail, False
We don't know what the EnableControls sub does, but that should work if the
SelectProject combo is not in the Detail section.
(If the form returns no records, and no new records can be added, Access
could have problems.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Robert" <no**@email.com > wrote in message
news:Pm******** ***********@fe0 1.news.easynews .com... I borrowed one of the forms from the MS Access Solutions database and altered it to fit my needs. The form was the 'EditProducts' form where you select a category from a combo which then populates another combo for products. Then when you select a product, the form displays the info for it. Everything is working well except, with the original, when the form is opened, the focus is on the SelectCategory combo box, while the form elements are greyed out until you select a category and product. When I open my form, the main form is active, and the focus is on one of those controls. Once I select an item from the first combo box in the header, then the form controls grey out until I select a option from the second combo. I am at my wits end trying to figure out what I've missed. I've posed the code for the form below.
Option Compare Database Option Explicit
Private Sub Form_AfterUpdat e()
' Requery SelectProduct combo box. Me!SelectProjec t.Requery
End Sub
Private Sub SelectClient_Af terUpdate()
' Enable and requery SelectProduct combo box. ' Disable controls in detail section.
Me!SelectProjec t.Enabled = True Me!SelectProjec t.Requery EnableControls Me, acDetail, False
End Sub
Private Sub SelectProject_A fterUpdate()
' Find record for product selected in SelectProduct combo box. ' Enable controls in detail section and disable ProductID text box. ' Go to SupplierID combo box.
DoCmd.ApplyFilt er , "ProjectID = Forms!frmWorksh eet!SelectProje ct" EnableControls Me, acDetail, True Me!ProjectID.En abled = False Me!ProjectLocat ion.SetFocus
End Sub
Private Sub SelectProject_B eforeUpdate(Can cel As Integer) If IsNull([SelectProject]) Then MsgBox "You must select a project." Cancel = True End If
End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lyn |
last post by:
Hi,
I hope someone can help.
I have a main form which mostly fills the Access window. In the bottom half
of this form I have a tab control to display various types of data related
to the main form record. In each page of the tab control, there are three
buttons: Add, Update, Delete. Any of these buttons will open another,
smaller form to add, update or delete the related data record.
Originally, I had placed the smaller form such...
|
by: Pete |
last post by:
Is there any way to change the default search to "Any Part Of Field"
instead of whole field? The first thing I ever do when searching for
something in a field is change the default setting from "Whole Field"
to "Any part of field" because that way I don't have to key in the
entire word I'm searching for. It is especially frustrating having to
explain this to all of the people using my database. Any help would be
appreciated. Thanks.
|
by: Ekim |
last post by:
hy,
I've got a quite simple application: one windows form that consists of a
button, and as soon as the user hits the button a second form shall appear.
The difficult thing about it is that I want the new form to be created as
"deactivated" - that means that the second form has an editbox in it, and
this must NOT have the focus - instead, the calling form shall keep its
focus.
One simple way would be to immediately set focus back...
|
by: David Hearn |
last post by:
I have a javascript function that is fired on the KeyDown event of a
textbox. I am adding the attribute to the textbox at page load to run this
javascript function. The javascript runs as expected and the text box that
is specified in the javascript gets the focus set to it, but my problem is
that the default button on the form is being pressed also so once the
textbox gets the focus, you barely see it before the page redirects. I want...
|
by: Stephen Muecke |
last post by:
The startup form of my application is used to open other forms containing
detail information on projects, organisations, employees etc (similar to
Outlook)
Each detail form has a print method (creates a PrintDocument and prints the
object)
The data prints as intended, however, when printing is completed, the
startup form then receives focus (the form I printed from gets hidden behing
the startup form)
I have worked around this by adding...
| |
by: kebabkongen |
last post by:
Hi,
I'm working on a JavaScript that is enabling / disabling a select
element according to whether a checkbox is selected or not.
This works fine in Firefox, but in Internet Explorer (v 6.0.2900) it
appears wierd:
When I disable the selevt element in IE, it continues to appear as
enabled (falsely) until I try changing it.
When I click on it, updates itself as grey as to indicate that it is
disabled.
|
by: shankwheat |
last post by:
I have a function which passes text from txtdebt to debtsbox which
works fine. However, I want to add code which examines the value of
debtsbox and if any of the values the user entered contain the string
"d" then I want to emable rblDebts which is disabled when the page
loads. This part is not working (no errors) and I'm not sure why.
Thanks.
<script type="text/javascript" language="JavaScript">
<!-- Begin
oldvalue = "";
|
by: Robert McEuen |
last post by:
Access 97/2003 Windows XP (Classic Start Menu)
I just converted an mdb from A97 to A2K3 and found something that,
after Google search, doesn't appear to have been addressed in cdma...
I have a form "frmMainMenu" that is the designated startup form (under
Tools-Startup). In the Open event of that form, I open another form
"frmHidden" and set its Visible property to false.
When I converted to A2K3, it worked fine just like in A97. ...
|
by: Semajthewise |
last post by:
Here it is cleaned up a little more.
Here's what this code does. It will take 2 fractions and add, subtract, multiply, or divide them. The user enters the fractions to be calculated into two textboxes. These can be entered as a whole number and a proper fraction, whole number and an improper fraction, just a proper/inproper fraction, or just a whole number.
Form build Requirements:
using Microsoft Visual Studio.NET 2003
single form...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |