473,772 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading "First" Record In form

13 New Member
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.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. DoCmd.Maximize
  3.  
  4. ' Turn the MouseWheel Off
  5. Dim blRet As Boolean
  6. ' Call our MouseHook function in the MouseHook dll.
  7. ' Please note the Optional GlobalHook BOOLEAN parameter
  8. ' Several developers asked for the MouseHook to be able to work with
  9. ' multiple instances of Access. In order to accomodate this request I
  10. ' have modified the function to allow the caller to
  11. ' specify a thread specific(this current instance of Access only) or
  12. ' a global(all applications) MouseWheel Hook.
  13. ' Only use the GlobalHook if you will be running multiple instances of Access!
  14. blRet = MouseWheelOFF(False)
  15.  
  16. ' Change the Caption on the form
  17. Me.Caption = "Reading Leaders and Student Readers"
  18.  
  19. ' Enable the lookup combo
  20. Combo114.Enabled = True
  21.  
  22.  
  23. ' Show the edit button
  24. cmdEdit.Visible = True
  25.  
  26. ' Show the New button
  27. New_Button.Visible = True
  28.  
  29. ' Show the Exit button
  30. cmdExit.Visible = True
  31.  
  32.  
  33. ' Hide the OK button
  34. cmdOK.Visible = False
  35.  
  36. ' Hide the Cancel Button
  37. cmdCancel.Visible = False
  38.  
  39. 'Hide the Delete Button
  40. cmdDelete.Visible = False
  41.  
  42.  
  43.  
  44.  
  45. End Sub
Mar 27 '08 #1
1 3009
Fiddler2
19 New Member
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
Mar 28 '08 #2

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

Similar topics

2
7694
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...
32
4154
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...
0
1061
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...
0
948
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
5
3200
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) +
0
973
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...
0
9619
marktang
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...
0
10103
jinu1996
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...
0
8934
agi2029
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...
1
7460
isladogs
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...
0
5354
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...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.