472,982 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Combo Box auto-fill on Form Open

Hi there,

As it will be very apparent in a moment, I am very new to Access and learning on the fly. (Much fun, but frustrating at the same time)

I currently am trying to get a Combo Box that I created with the Combo Box wizard to run its After Update code on Form Open instead.

The current code looks like this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo10_AfterUpdate()
  2.     ' Find the record that matches the control.
  3.     Dim rs As Object
  4.  
  5.     Set rs = Me.Recordset.Clone
  6.     rs.FindFirst "[UserName] = '" & Me![Combo10] & "'"
  7.     If Not rs.EOF Then Me.Bookmark = rs.Bookmark
  8. End Sub
  9.  
Also, I have the Default Value of the Combo Box set to:

CurrentUser()

and the Row Source of the Box to:

SELECT Student_Information.UserName FROM Student_Information;


P.S. I have also tried putting CurrentUser() in the Control Source field.


More Details:

What I am trying to do is have the students access forms that they need to fill out, however I dont want the students looking at other students information, so I want it to populate the form based on the current users login name.

Am I going about this the wrong way, or am I just missing some really simple step.

Thanks in advance.
Aug 1 '07 #1
1 4482
Rabbit
12,516 Expert Mod 8TB
1) On Open occurs before any values are loaded. On Load occurs after the values are loaded.

2) This will not prevent them from going to other records. Instead, you want to use the Filter property of the form to only show those records that relate to the student.
Aug 1 '07 #2

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

Similar topics

0
by: Bill K | last post by:
Does the vb.net combo box control have the auto complete/expand feature like the Access combo box - where you begin typing in the conbo box and the first possible choice appears? If so, how do...
2
by: Dwight | last post by:
Help ! Have a combo box in accsess, with 6 fields, I want each to show up a different colour when they ar selected/viewed. I have tried the following code but seems to have no affect can anyone...
2
by: Jim Devenish | last post by:
I have a combo box with Auto Expand and Limit to List both set to 'yes'. When I type 'C' I correctly get: C J Valeting When I type 'CO' I get: Cogent Seating Ltd again correct BUT when I go...
9
by: Bob Alston | last post by:
I have a drop down combo box that gives the user to enter an item not in the list by adding it to the list. The list is a table. It works fine on Access2003 but fails on Access2002/XP. ON XP, it...
0
by: VenuGopal | last post by:
hi, i have implemented a MultiColumn Combo by overriding thr Combo Box's DropDown Event. In the Event i have populated a DataTable to contain the Necessary MultiColumns. Now i need to implement...
1
by: pemigh | last post by:
In a prior posting (too old to reply directly), Jim Devenish described exactly what my client has seen, both in terms of AutoExpand behaving oddly and the way that caps lock relates to the...
2
by: Abdhul Saleem | last post by:
Hi, Any code snippet or help link available on how to auto resize the dropdown list part of the combo(<select>) ? Or, is there any alternative techniques for displaying the full lenth text...
3
by: joseph.mccastlain | last post by:
Hello All, I am a new user to Access. I am currently designing a database consisting of four tables for multiple users. Rather than bore you with the goals and such, here is what I am...
3
by: John | last post by:
AC2007 I changed my combo's row source and then the autocomplete stopped working. The combo is two columns, bound to the first. First column is primary key (ID). Second column is a...
3
by: mahesh123 | last post by:
Hi Folks, I want Help regarding the Auto search in the Combo Box. When I am pressing the characters it will move to the appropraite words in the Combo Box. For Example if the Combo Box filled...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.