Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8737063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:25:59+00:00 2026-06-13T10:25:59+00:00

all. I have a table in the worksheet called lookupMisc called periodNo (A) and

  • 0

all. I have a table in the worksheet called lookupMisc called periodNo (A) and periodName (B) with the following values.

A   B
1   09:00
2   10:00
3   11:00
4   12:00
5   13:00
6   14:00
7   15:00
8   16:00
9   17:00

The code for this as follows:

   For i = 1 To ws_misc.Range("periodNo").Rows.Count
        CombinedName = periodNo(i, 1) & " - " & periodName(i, 1)
        cbo_period.AddItem CombinedName
    Next i

and thsi generates:

enter image description here

Now you will notice that there is a Length (txt_length) text field to the right. Basically I am trying to create a form of dynamic validation based on the entry that period has. Here are the cases:

If user selects  Then
1 - 09:00        Length can only accept values from 1-9
2 - 10:00        Length can only accept values from 1-8
3 - 11:00        Length can only accept values from 1-7
4 - 12:00        Length can only accept values from 1-6
5 - 13:00        Length can only accept values from 1-5
6 - 14:00        Length can only accept values from 1-4
7 - 15:00        Length can only accept values from 1-3
8 - 16:00        Length can only accept values from 1-2
9 - 17:00        Length can only accept values from 1-1

How would I go about accomplishing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:26:01+00:00Added an answer on June 13, 2026 at 10:26 am

    Try something like:

    if me.txt_length.value<1 or me.txt_length.value>10-clng(left(me.cbo_period.value,1)) then
        msgbox "Entry must be between 1 and " & 10-clng(left(me.cbo_period.value,1))
    end if
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table called TPM_TASKS which contain all tasks, as well as a
I have the following table in Sheet1, which will be a password-protected worksheet: A1:
I have this code that aggregates multiple workbooks into a preview file where all
I have a table that stores all values..eg x1, x2, x3 which determines fuzzy
I have table 1, all_countries, as follows- id | country ------------------ 1 | USA
I have a table that contains all the data about users . Users can
I have a table with all U.S. zip codes. each row contains the city
All rows in a table have a type field which is either 0 or
I have a table with 18 columns (all Ints) and 1040 rows. If any
I have a table which i want to store all the outputs into one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.