MS Access Mask Credit card numbers - ms-access

i have table in MS Access that has a column with credit card information. the credit card information can be in any format anywhere in that string. but i need to render it not usable.
example: my card number 2343 25545 454555 2424 exp:12-12
ie. it can be in any format. any location in the string. beginning or end
i need to detect 4 digit sequence and replace or delete.
How to do that? sql, macro,...?
my final goal is to have scheduled daily job that is going to delete / replace some of the CC digits.
Thanks

Related

Need a proper input mask for a time field in Microsoft Access

My table field is date/time and formatted like this:
mm/dd/yyyy hh:nn:ss
I want the user to see this (with the space appearing between date and time
__/__/__ __:__:__
I want an input mask that demands:
Either 1 or 2 digits for the month
Either 1 or 2 digits for the dat
All 4 digits for the year
SHOWS the space but just jumps over it for the user
Either 1 or 2 digits for each of Hours, Minutes and Seconds
Further, when setting up a DB, is it just smarter to have two separate fields for Date and Time. A collegue encouraged me to break them out ... seems sensible?
00/00/0000##00:00:00
See the outcome in the image
Controlled user input is not an easy task in Access, as it is optimised for the opposite: To be tolerant and accept many input sequences for date and time.
For the cases where controlled input is mandatory, I've written two articles including full code (too much to post here) and demo, that may give you some ideas:
Entering ISO formatted date with input mask and full validation in Microsoft Access
Current code at VBA.DateEntry.
and
Entering 24-hour time with input mask and full validation in Microsoft Access.
Current code at VBA.TimeEntry.

Using last number from the first 4 numbers to fetch users details from MySQL

If I have digits like this(account numbers actually).
200101
200201
200201 is for saving account while 200101 is a current account.My main goal is to fetch all details of users with acount that start with 2001 from mysql. How can I manipulate number like this in MySQL to pull out the users details?
If the account number is a string, then use:
where accountnum like '2001%'
If it is a number, then I presume you want to lop off the last two digits. For that, use division:
where floor(accountnum / 100) = 2001
I don't recommend using string functions on numbers and vice versa.

Mysql datatype for money

i was trying to create a money related app in which users can choose their currency. Mysql datatype i tried is decimal(19,4). Now the problem is few currencies need three precisions and some need two
Eg:
oman rial needs three precisions. ie 1000 baisa = 1 omani rial. Hence my customers may enter 6.783 omani rial.
Where as my US customers will need only 2 precisions as 100 cents = 1 dollar and they may enter 5.50.
When i insert these two entries to my database using decimal(19,4), it is saved as 6.7830 and 5.5000 respectively.
Now the real pain is when i need to display their entrys as i dont want to display that extra 0 in omani rial entry and that 00 in US dollar. I also tried float but last digit gets rounded off at times.
Is there any mysql data type in which i can save exact entry as it is without any rounding off or extra zeros? If there is no such entry, how can i make it ppssible?
You can use VARCHAR to store exact representations, but I don't recommend that because it takes more bytes to store a number as a string. And any arithmetic you do on the value will convert it to a number anyway.
I recommend you use DECIMAL(19,4), and then format the value in application code, to display it with the appropriate digits. Every programming language has some function like printf() that allows you to control the output formatting, regardless of the value stored.

Find the exact phrase in a string (SQL Server 2008)

I receive the file from third party, which I upload to a table. It has a Description column in which I have to find an "Account NO" (9 characters in length).
A few sample descriptions:
FROM AMH-061060-POK UNSECURED OVER 40 DAYS
MAINTENANCE FEE A/C A4G123456
ADJUST BALANCE VS 6PK-123123
REIMBURSEMENT OF CHECK RE-ORDER FEE A4G111111 p11
Asset Mgmt acct gold annual fee MPL NFL234234.
Description column is a free text and doesn't know where the account no appears.
As you see above, it may appear at the end of the description or in the middle somewhere or at the start.
For this AMH-061060-POK, we truncate POK and remove '-' to get 9 length account number.
Any help is appreciated in finding the account number using SQL functions?
Anupama - in the first example, how do you know that the account number is "AMH-061060" and not "UNSECURED"? Both are nine characters.
What is logic in determining which string is the account number? First define it, then you can code it.

Converting measurements in a form to update a table

I am using Access 2010 to create a database of fish caught by local fishermen. I have a table with all the information about each fish caught (location, day, length, etc) and a form to add new records to that table. I am trying to automate as much of the data entry as possible because we have many interns that will be entering data throughout the summer. The more I can have the program do, the more I can limit mistakes in data entry.
I would like to store the length data in metric (mm), however most of the fishermen report the lengths of the fish they catch in inches. I don't care to have length twice in my database, one metric and one imperial.
Is there a way I can have a box on the form that someone can enter the length in inches and this value is converted to metric and used to fill in the length field on the table? The trick is that sometimes the fish length is reported in metric, so I need to be able to directly input metric into the form too.
I'm guessing this is either not possible or already somewhere & I am not using the right key words in my searches. I appreciate anyone who can point me in the right direction.
Thanks!
Here's one way to do it. It's similar to Scotch's, but with a few enhancements.
Have 2 textboxes. 1 each for millimeter & inch sizes.
The Milimeters textbox is bound to the table through the Control Source, so what is entered in there is what is saved in the database.
The Inches textbox is unbound. But what is entered into that textbox is converted and the new value is put into the Millimeter textbox. The code would look like this:
Private Sub txtSizeIn_AfterUpdate()
Me.txtSizeMM = Me.txtSizeIn * 25.4
End Sub
This way, the fisherman will have a choice on what measurement to use.
In the After Update for your control in which the measurement is entered, say the control is called Length.
You can change it in vba with this code.
Me.length = me.length * 25.4
This is one of many ways to do this