467,914 Members | 1,878 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Using a DropDown Lookup to Populate 2 fields in an Access Query or Form

16bit
Hello Everyone!

My EmployeeData tbl contains a field PPID_Data (number field). I am using this field to lookup values from another table called PayPeriods, which contains all the data for the year 2021.

Expand|Select|Wrap|Line Numbers
  1. SELECT PayPeriods.PPID, PayPeriods.PP, PayPeriods.StartDate, PayPeriods.EndDate
  2. FROM PayPeriods
  3. ORDER BY PayPeriods.PP;
  4.  
Expand|Select|Wrap|Line Numbers
  1. PPID    PP    StartDate    EndDate
  2. 1    01 - Week 01    21-Dec-21    27-Dec-20
  3. 2    02 - Week 03    04-Jan-21    10-Jan-21
I am looking for the best way to have the [StartDate] and [EndDate] update on the form, or using a query, when the user selects the PayPeriod [PP] from the dropdown.

I was able to successfully get the unbound field [SDate] to populate on the form using the code below, but could never get the [EDate] to work. I'm sure I'm missing something simple, but would be happy to learn if there is a better way to reference the fields.

Expand|Select|Wrap|Line Numbers
  1. Private Sub PPID_Data_AfterUpdate()
  2. Me.SDUnbound = Me.Combo800.Column(2)
  3. Me.EDUnbound = Me.Combo800.Column(3)
  4. End Sub
3 Weeks Ago #1

✓ answered by MikeTheBike

Hi Sue

Just a thought, is the droplist column count set to 4?

MTB

  • viewed: 1446
Share:
2 Replies
Expert 512MB
Hi Sue

Just a thought, is the droplist column count set to 4?

MTB
3 Weeks Ago #2
16bit
Nope, it hadn't been.
It's always the little things that get overlooked, isn't it? Thanks Mike!
3 Weeks Ago #3

Post your reply

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

Similar topics

1 post views Thread by tina.boroff | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.