Google Answers Logo
View Question
 
Q: VB6 - creating a database. How to set a field to have a Password input mask? ( No Answer,   3 Comments )
Question  
Subject: VB6 - creating a database. How to set a field to have a Password input mask?
Category: Computers > Programming
Asked by: trevor92-ga
List Price: $10.00
Posted: 16 Feb 2004 12:36 PST
Expires: 17 Feb 2004 23:09 PST
Question ID: 307380
I'm writing a program that creates an Access database from scratch using DAO 3.6

If I create a table in Access, I can select a field, choose 'Input
Mask' and select 'Password' from the list provided.

I'd like to do this using VB. The VB code snippet I'm using to create the field is:

 f1.Name = "MyPassword"
    f1.Type = dbText
    f1.Size = 25
    newTD1.Fields.Append f1

What I'd like is the VB code to replicate the Access Input Mask =
Password part of things. I hope this is just one more line of code.

I realise that this isn't the most secure way of doing things but it
keeps the password away from prying eyes, at least in the first
instance, so it's good enough for me...

Request for Question Clarification by answerguru-ga on 16 Feb 2004 13:30 PST
Hello trevor92-ga,

I'm fairly sure you can achieve this result by adding this line:

f1.PasswordChar = *

This is mentioned in a Google Groups discussion posting:
http://groups.google.ca/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=3970fc68%240%2412152%40bru5-newsr2.be.uu.net&rnum=3&prev=/groups%3Fq%3Dvb6%2Bpassword%2Bfield%2Bmask%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den

If it works let me know and I can post this as an official answer :)

Cheers,
answerguru-ga

Clarification of Question by trevor92-ga on 16 Feb 2004 23:35 PST
f1.PasswordChar = *

gives the error 'Method or data member not found'

sorry :(
Answer  
There is no answer at this time.

Comments  
Subject: Re: VB6 - creating a database. How to set a field to have a Password input mask?
From: irishpheremone-ga on 17 Feb 2004 01:40 PST
 
trev-

You have to add the table then create the property "InputMask"... 

Heres an example that worked for me:



Private Sub Form_Load()

    ' Locals {
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Dim prp As DAO.Property
    ' }
    
    ' New database
    Set dbs = DBEngine.Workspaces(0).CreateDatabase("C:\temp\temp.mdb",
dbLangGeneral)
    
    ' New table
    Set tdf = dbs.CreateTableDef("temp")
    
    ' New field
    Set fld = tdf.CreateField("field1", dbText, 50)
        
    ' New property
    Set prp = fld.CreateProperty("InputMask", dbText, "Password", True)
            
    ' Add field
    Call tdf.Fields.Append(fld)
    
    ' Add table
    Call dbs.TableDefs.Append(tdf)
    
    ' Add property (have to do it after table is added!)
    Call fld.Properties.Append(prp)
    
    ' Close
    Call dbs.Close

End Sub
Subject: Re: VB6 - creating a database. How to set a field to have a Password input mask?
From: trevor92-ga on 17 Feb 2004 06:06 PST
 
Thanks!

That works a treat...

Trevor

P.S. How do I pay you?!
Subject: Re: VB6 - creating a database. How to set a field to have a Password input mask?
From: irishpheremone-ga on 17 Feb 2004 17:47 PST
 
trev-

I am a newbie too... Thought I'd make $10! But it doesn't look like it
- I'd suggest cancelling your question before your charged for it...

If I figure out how to become an answerer - I'll let you know and,
maybe, you can get me later!

-Casey

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy