?
Solved

Numbers for Transponder Codes

Posted on 2004-04-01
3
Medium Priority
?
937 Views
Last Modified: 2013-12-25
Hello there,

I am setting up a database in Access for eventual use in a VB6 program (if I ever get that far).

My problem is as follows;

In aviation, aircraft are assigned a 4 digit code (Transponder Code), using an octal system, that is to say only the numbers 0 thru 7 are useable, so that the numbering could follow the following sequence;

0000,0001,0002,0003,0004,0005,0006,0007
0010,0011,0012,0013,0014,0015,0016,0017,
0020,0021,0022,0023,0024,0025,0026,0027....

thru

7760,7761,7762,7763,7764,7765,7766,7767,
7770,7771,7772,7773,7774,7775,7776,7777,

This code is issued as an exclusive code (within a specified geographical area) that Air Traffic Control use to identify an aircraft on Radar Displays.

MY QUESTION IS;

How can I create a mask (in Access and later in VB6) to permit only the input of "allowed" codes?

There are some other related questions in this regard that I will post as I get to that stage.

Thank you in advance

VeeBee
0
Comment
Question by:VeeBeeSix
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
ameba earned 2000 total points
ID: 10730872
' Form1, add textbox
Option Explicit

Private Sub Form_Load()
    Text1.MaxLength = 4 ' this can be set in properties at design time
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    ' filter keyboard input:
    ' allow control characters and digits 0-7
    If KeyAscii > 31 And Not (Chr(KeyAscii) Like "[01234567]") Then
        KeyAscii = 0
        Beep
    End If
End Sub


You can also set style of your textbox to ES_NUMBER, see http:Q_20106317.html#6012596
0
 

Author Comment

by:VeeBeeSix
ID: 10730901
OK, that worked for the VB6 part.

Is there a way to use that in Access ?

VeeBee
0
 
LVL 15

Expert Comment

by:ameba
ID: 10731054
Sorry, I don't code in Access. Maybe you can ask in Access topic area or add a 'pointer question' (20pts question saying: please see http:/VB_Databases/Q_20939693.html)

Access TA is here: http://www.experts-exchange.com/Databases/MS_Access/
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question