Hello All,
I have the folowing case.
table Countries: Country_ID, Country_Name, PHCODE
In a form i have the folowing fields:
SCountry
SCPhone1
SCPhone2
I want when i choose a country from the combobox Scountry
the input mask for SCPhone1 and 2 to load the PHCODE(international phone code) form the Countryes table.
I'm sure it is easy but i can seems to make it work.
I have managed to do it:
Hope this code will help someone else as i found alot of q about such thing and no answers: -
Private Sub SCCountry_AfterUpdate()
-
Dim mask As String
-
-
mask = ""
-
mask = DLookup("PHCODE", "Countries", "Countryid='" & Me.SCCountry & "'")
-
-
SCPhone1.InputMask = "(+" & Replace(Replace(mask, "9", "\9"), "0", "\0") & ")##########"
-
SCPhone2.InputMask = "(+\" & Replace(Replace(mask, "9", "\9"), "0", "\0") & "\)##########"
-
SCMPhone3.InputMask = "(+\" & Replace(Replace(mask, "9", "\9"), "0", "\0") & "\)##########"
-
SCFAX1.InputMask = "(+\" & Replace(Replace(mask, "9", "\9"), "0", "\0") & "\)##########"
-
SCFAX2.InputMask = "(+\" & Replace(Replace(mask, "9", "\9"), "0", "\0") & "\)##########"
-
SCMail.InputMask = "#############" & "@" & "#################" & "." & "###"
-
-
End Sub
-
3 2657
I used DlookUp but i get error message: 'country code value' runtime error 2471 -
Private Sub SCCountry_AfterUpdate()
-
Dim mask As String
-
mask = DLookup("PHCODE", "Countries", "Countryid=" & Me.Form!SCCountry)
-
SCPhone1.InputMask = "("& "+" & mask & ")"
-
End Sub
-
if i remove "Countryid=" & form dlookup it works, but i always returns (+35_)
wich is the part of the phone code for Bulgaria
Well i did it:
Syntax error -
Dim mask As String
-
mask = ""
-
mask = DLookup("PHCODE", "Countries", "Countryid='" & Me.SCCountry & "'")
-
SCPhone1.InputMask = "(" & "+" & mask & ")"
-
Now another problem if the phone code contains 9 or 0 guess how the input mask interpret it _. If anyone has a suggestion pleases post.
TX
I have managed to do it:
Hope this code will help someone else as i found alot of q about such thing and no answers: -
Private Sub SCCountry_AfterUpdate()
-
Dim mask As String
-
-
mask = ""
-
mask = DLookup("PHCODE", "Countries", "Countryid='" & Me.SCCountry & "'")
-
-
SCPhone1.InputMask = "(+" & Replace(Replace(mask, "9", "\9"), "0", "\0") & ")##########"
-
SCPhone2.InputMask = "(+\" & Replace(Replace(mask, "9", "\9"), "0", "\0") & "\)##########"
-
SCMPhone3.InputMask = "(+\" & Replace(Replace(mask, "9", "\9"), "0", "\0") & "\)##########"
-
SCFAX1.InputMask = "(+\" & Replace(Replace(mask, "9", "\9"), "0", "\0") & "\)##########"
-
SCFAX2.InputMask = "(+\" & Replace(Replace(mask, "9", "\9"), "0", "\0") & "\)##########"
-
SCMail.InputMask = "#############" & "@" & "#################" & "." & "###"
-
-
End Sub
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dude |
last post by:
hello
how would i make an input mask that only makes the first letter a
capitol one?
i've been playing around and testing various masks, also tried the
wizard, but i've had no luck.
could...
|
by: johnp |
last post by:
Hi,
Our Tech department updated users to Office 2003 this week. Now the
input mask in one of the applications is showing up as:
(###) ###-###
The input mask wizard works correctly when I...
|
by: F. Michael Miller |
last post by:
I have a db with Access front end, sql back, linked tables. I need to be
able to change input masks at the table level in code.
Any ideas?
Thanks!
|
by: AA Arens |
last post by:
When I want the first character of a field to be Uppercased, I need to
make an input mask, like >L< followed by ??????? for example. But this
mask creates ____ in an unfilled field, which I don't...
|
by: Jon Peck |
last post by:
I'm largely self-taught (so hardly an expert) in Access 2002. I'm wondering
if it's possible to have a conditional input mask on a field in a form.
My database keeps track of people who register...
|
by: jmarr02s |
last post by:
I am using the following input mask 00\-A0000000. The values entered
using this input mask will have one of the following formats:
14-X1234567 OR 14-1234.
What must I change on the textbox...
|
by: jmarr02s |
last post by:
I need my Date field to possess the following format: Jan-05-1999
How do I change the Date Format/Input Mask to accomplish this?
Thanks!
John
|
by: Doug |
last post by:
Hi,
I created a short date field. The format is dd/mm/yyyy when displayed.
The input mask is set to 99/99/00;0 (default, I didn't type anything).
If I edit an existing date, say change...
|
by: Mtek |
last post by:
Hi,
We have a combo box on our page, which gets populated via a MySQL
Query in PHP.
What we want to do is to print the values on the page in a table that
correspond the to selection from the...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |