I have a Database form in Single View for users to look-up and/or enter data. When the form loads the combo box is empty, which I like - but the fields in the form are all filled in with what the database sees as the "first" record - which is alphabetically not the first, but is as to the ID field. All that said, I would like the fields to either fill in with the alphabetical first record, or merely blank. I found the code to have it load New - but I don't want a New record because often it is merely opened to look-up data, not enter.
Here is my form load code. Any additional code would be most appreciated. -
Private Sub Form_Load()
-
DoCmd.Maximize
-
-
' Turn the MouseWheel Off
-
Dim blRet As Boolean
-
' Call our MouseHook function in the MouseHook dll.
-
' Please note the Optional GlobalHook BOOLEAN parameter
-
' Several developers asked for the MouseHook to be able to work with
-
' multiple instances of Access. In order to accomodate this request I
-
' have modified the function to allow the caller to
-
' specify a thread specific(this current instance of Access only) or
-
' a global(all applications) MouseWheel Hook.
-
' Only use the GlobalHook if you will be running multiple instances of Access!
-
blRet = MouseWheelOFF(False)
-
-
' Change the Caption on the form
-
Me.Caption = "Reading Leaders and Student Readers"
-
-
' Enable the lookup combo
-
Combo114.Enabled = True
-
-
-
' Show the edit button
-
cmdEdit.Visible = True
-
-
' Show the New button
-
New_Button.Visible = True
-
-
' Show the Exit button
-
cmdExit.Visible = True
-
-
-
' Hide the OK button
-
cmdOK.Visible = False
-
-
' Hide the Cancel Button
-
cmdCancel.Visible = False
-
-
'Hide the Delete Button
-
cmdDelete.Visible = False
-
-
-
-
-
End Sub
1 3009
If you want it to be alphabetical, simply add a sort to the underlying query of your form.
Using a bound form like this, you could "clear" everything on startup by setting the default value of your UNBOUND combobox to this:
cboBoxName.item data(0)
then, bind your primary field in your recordset (in the underlying querygrid) to the combobox. When the form opens, the combo box will be set to nothing, and so will the form.
To make items show up, put the following code in the "after update" event of the combobox:
me.requery
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Wm |
last post by:
I'm trying to get a handle on the best way to handle setting up my listings
so that I display groups of about 25 records per page. I currently have a
page that returns over 1,000 names/addresses, which is obviously not very
efficient. Does anyone have any suggestions on the best way to approach
this, or recommendations on what pitfalls to avoid? I'm assuming that I need
to be able to count the total number of records that match the search...
|
by: James Curran |
last post by:
I'd like to make the following proposal for a new feature for the C#
language. I have no connection with the C# team at Microsoft. I'm posting
it here to gather input to refine it, in an "open Source" manner, and in an
attempt to build a ground-swell of support to convince the folks at
Microsoft to add it.
Proposal: "first:" "last:" sections in a "foreach" block
The problem:
The foreach statement allows iterating over all the...
|
by: Scott Emick |
last post by:
I have a main entry screen for a contact manager that has some buttons which
can launch various other forms and these launch without any problems. I
check if the form already exists and set focus to it, or instantiate it and
show it otherwise. The user can flip back and forth by design.
The problem comes in when I am trying to launch a script in a form that
guides the user through a script that directs him/her step-by-step how to
fill...
|
by: Bob |
last post by:
Loading data in a datagridview control in Vs2005, Vb.Net. If data is loaded
in control I need first record shown to be automatically the selected
record. By defaukt it is not considered selected, user has to click in the
selection box on left of grid to have a record selected.
How can I automatically get first shown record to be selected?
Any help appreciated.
Bob
|
by: comp.lang.php |
last post by:
$orderBy = 's.app_date desc, s.last_name asc, s.first_name asc, s.mi
asc';
if ($_REQUEST) {
$ascArray = array('asc' => 'desc', 'desc' => 'asc'); // ARRAY OF
ALL ORDERING POSSIBILITIES
$junk = preg_match('/(+)a|sc(,?.*$)/i', $orderBy,
$matchArray);
$orderBy = substr($orderBy, 0, strpos($orderBy, $matchArray)) .
' ' . $ascArray] .
substr($orderBy, strpos($orderBy, $matchArray) +
| |
by: Tony K |
last post by:
While performing a fill() method, the first record NEVER shows the correct
price of database item. The 2nd record and every record that has a price
will show the correct price. If I open the Access DB through Access, the
price is shown correctly in the table. I have double checked my
DataBindings but it always shows $0.00 in the UnitPriceTextBox.
Private Sub FormProducts_Load(ByVal sender As System.Object, ByVal e As...
|
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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |