473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to focus on a specific record when clicking a row on a combobox

I've made a database for my contacts. On the top of my main form (names) I put a combobox where the row source is :
Expand|Select|Wrap|Line Numbers
  1. SELECT [names].[ID]
  2.    , [names].[firstname]
  3.    , [names].[lastname] 
  4. FROM [names] 
  5. ORDER BY [lastname];
that will show me a list of ID name and last name of each record (each row of that list is a record). I want everytime that I click on a row of that list to focus on that record.
Jul 4 '13 #1
8 1367
zmbd
5,501 Expert Mod 4TB
You will need to do this via VBA in the afterupdate/onchange events.

You may find these methods of some help:
Jul 4 '13 #2
thanks but I don't know how to do this... can you provide me an example or something? or a source with way less info than the link you provided me? there are almost 200 things there and I don't know what will work for me. :/

someone messaged me that I have to do this from the event on the properties of my combobox.. will this do? if yes what I have to type exactly?
Jul 4 '13 #3
zmbd
5,501 Expert Mod 4TB
There are 4 links in my post.
The first is just the general link to all of the available articles.
Then the links to articles #42, #55, and #168.

As for PM, the suggestion is as I have given in the first part of my post. The links in the articles will explain some of this to you.

You might remind the person that pm'd you that responses should be made within the threads where we can all benefit from the efforts.
Jul 4 '13 #4
I checked the links and they are very confusing. not sure if this is what I am looking for. Also it's like reading a whole encyclopedia for something that the answer is not that big ( I think).

I attached an example of what I am looking for.. it's a ready-template database (along with an image). I kept only a few elements and deleted the rest of forms tables etc. so don't mind the error messages. The form still works. Go to "employee details" form (skip the error messages) and then click on the "go to" combobox. You will see a dropdown list with 1 (more) record. If I click on it then it will focus on that record. this is what I want to do .. the exact same button! I know that something has to be made with VB but I am not sure that the code is that long.

Attached Images
File Type: jpg example.jpg (34.5 KB, 245 views)
Attached Files
File Type: zip Marketing projects1.zip (93.0 KB, 72 views)
Jul 4 '13 #5
zmbd
5,501 Expert Mod 4TB
Please understand that most of us are either unable to open/view attachments as we're at work, or will not open an unsolicited attachment just as a matter of Best Safe Computing Practices (esp. #6 and #7). This should in no way be taken personally. It is much better to have a well worded/phrased description of the goal, the current issue, exact errors, and so forth as these will turn up in the search engines for others to find should they be in the same or simular situation as you find yourself in today.
(more to follow)
Jul 4 '13 #6
zmbd
5,501 Expert Mod 4TB
We (mods/experts/admins) must work with the concept that the posters have a moderate working knowledge of MS Access and its GUI design interface (can make a query, can make a form, etc), SQL (at least as it relates to Access), and a working knowledge of VBA and how to get into the VBA-Editor.

What you are asking for is both simple and complex; hence, why I posted the other links.

Modification of a template can be very frustrating, especially if the designer used a mix of macros and vba.
You didn't mention which version of Access you are using so I will proceed as though you are using v2010:

In your case, I would suggest that you open in design view the form that has the operations as you'd like to have on the second form.
Right-Click on the control (the combobox) that has the behavior that you desire, in the popup, select "properties."
Now click on the event tab at the top of the properties box.
You will now see a list of events along the left and if there is associated macro/code you will see something like "[Event Procedure]" (vba) or [Embedded Macro] (macro).
You will need to look at the afterupdate and onchange events.
Review this code and see how they are doing the operation.
Once you understand how things are working, you can then copy and paste the code into the second form and modify it for the forms recordset.
Jul 4 '13 #7
(after reading you last post) I use MS Access 2007 and windows XP (but I don't think that windows have to do with this - just saying)
Jul 4 '13 #8
zmbd
5,501 Expert Mod 4TB
The OS shouldn't be an issue, knowing that you are attempting to modify a template and that you are using MS Access 2007 will be helpful.
- The directions I posted for 2010 will work for 2007

Once you get into the propeties on the control that does what you want please let us know which ("[Event Procedure]" (vba) or [Embedded Macro] (macro)) type of code is indicated. It will make a HUGE difference in helping you to post it and modify it for your use.

ONE MORE THING---
BACK UP YOUR FILE BEFORE modifying it too much. That way if we goof you haven't lost much if anything.
Jul 4 '13 #9

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

Similar topics

2
by: aaj | last post by:
Hi all I have a small but rather annoying problem with continuos forms, and am wondering if anyone can suggest a method of getting over it. The front end is Access 2002 with the BE being SQL...
3
by: Andrew Wrigley | last post by:
Hi I have what seems a corruption of an mdb that is not solved by the decompile command line trick. The problem appears when clicking on a subform control (check box) that has a event handler...
12
by: swingingming | last post by:
Hi, in the NorthWind sample database, when clicking on the next navigation button on the new order record with nothing on the subform (order details), we got an order with nothing ordered. How can...
3
by: Steve Yerkes | last post by:
There seems to be way too much confusion over how to set focus on the a field using a field validator. I looked all over the web and found people trying to do this, but not getting anywhere. There...
2
by: André | last post by:
Hi, I made a detailsview containing several fields for inserting only. I also made a dropdownlist which is invisible at start. Now, when clicking in a particular textbox, the dropdownlist must...
1
by: karups | last post by:
Hi I have binded a dataset to my datagrid. Datagrid is present inside a >DIV></DIVtag of specific height. Only 5 records will be visible at a time when i edit the 10th record, the page...
0
by: karups | last post by:
Hi I have binded a dataset to my datagrid. Datagrid is present inside a >DIV></DIVtag of specific height. Only 5 records will be visible at a time when i edit the 10th record, the page...
33
by: me2tech | last post by:
Hi, This is ram. I am developing a page(usereg.jsp) with two textboxes one for username and another for email. Since i am using this page in main.jsp using Ajax, I am removing the body part in...
1
by: bkberg05 | last post by:
Hi -I have a form which contains a sub-form. The sub-form is tied to the main form by a shared field called Project_ID. The main form has one record per Project. The sub-form has many records per...
2
by: polluxsoftech | last post by:
i want to enter text in textbox by dropdown only when clicking on button i want that all this perform at client side by javascript.. this is dont in apsx page but i want it in .ascx this is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.