470,648 Members | 1,381 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

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
  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
Also, I have the Default Value of the Combo Box set to:


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 4132
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

Post your reply

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

Similar topics

reply views Thread by Bill K | last post: by
2 posts views Thread by Dwight | last post: by
2 posts views Thread by Jim Devenish | last post: by
1 post views Thread by pemigh | last post: by
2 posts views Thread by Abdhul Saleem | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.