Teaser

azizrasul

Well-known Member
Joined
Jul 7, 2003
Messages
1,304
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
I have a form with 7 text boxes and 4 combos. They are named txt1, txt2, ... txt7, cbo1, cbo2, ... cbo4. The values in these controls make up a telephone number.

The text boxes have fixed values of 0121458.

The combos cbo1 & cbo2 can have the following values 0-9, *, Even or Odd.

The combos cbo3 & cbo4 can have the values 0-9.

The task is to make a selection in the combos and run a query based the telephone number. Hence I can have the following telephone numbers: -

01214580000
0121458**13
0121458Even234
0121458Odd456
0121458EvenOdd842
0121458*Odd43

and so on.

I have been trying the following telephone number: -

0121458**48

knowing that there are telephone numbers like 01214580048, 01214583248, etc.

My VBA code combines the values in a label i.e.

Me.lblTN.Caption = Me.txt1 & Me.txt2 & Me.txt3 & Me.txt4 & Me.txt5 & Me.txt6 & Me.txt7 & Me.cbo1 & Me.cbo2 & Me.cbo3 & Me.cbo4

I then use: -

[Forms]![frmSFF Creation]![lblTN].[Caption]

When I run the query, I don't get any records appearing when Me.lblTN.Caption = 0121458**48
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I can't check it at the moment but i think that you need

Like [Forms]![frmSFF Creation]![lblTN].[Caption]

HTH

Peter
 
Upvote 0

Forum statistics

Threads
1,221,573
Messages
6,160,591
Members
451,657
Latest member
Ang24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top