?
Solved

I cant retreive the values from the maskedit boxes

Posted on 2001-06-12
4
Medium Priority
?
177 Views
Last Modified: 2010-05-18
Hi folks,
my maskedit controls are working well but when I type in an account number and press find it only retreives the values from the text boxes.


This is the cmdEnter code:

Private Sub cmdEnter_Click()
Const conMsg As String = "Account numbers range from 1 to 30."
Const conBtns As Integer = vbOKOnly + vbInformation _
+ vbDefaultButton1 + vbApplicationModal

Dim udtCredit As CreditStruc
Dim strFilename As String
Dim intUserResponse As Integer
Dim intAccNum As Integer, x As Integer

On Error GoTo errHandler

intAccNum = Val(mskAccNum.Text)
dlgCom.FileName = strFilename
strFilename = "A:\Data.dat"

Open "A:\Data.dat" For Random As #1 Len = Len(udtCredit)


udtCredit.intAccNum = mskAccNum.Text
udtCredit.dteBirth = mskBirth.Text
udtCredit.strLast = txtLast.Text
udtCredit.strFirst = txtFirst.Text
udtCredit.curBalance = mskBalance.Text
udtCredit.strTelNum = mskTelNum.Text
udtCredit.intIDNum = txtIDNum.Text
udtCredit.dteDateTrans = mskDateTrans.Text
udtCredit.dteDate = lblDate1.Caption

For x = 1 To 30
Put #1, intAccNum, udtCredit
Next


Close #1
Call ClearFields
errHandler:

mskAccNum.SelStart = 0
mskAccNum.SelLength = Len(mskAccNum.Text)
mskAccNum.SetFocus

End Sub

This is the Clearfields code:

Private Sub ClearFields()
'Clear the form for the next record
Dim strMask As String

mskAccNum.Mask = ""
mskAccNum.Text = ""
mskAccNum.Mask = "###"
mskBirth.Mask = ""
mskBirth.Text = ""
mskBirth.Mask = "##/##/####"
mskTelNum.Mask = ""
mskTelNum.Text = ""
mskTelNum.Mask = "(##) (########)"
txtLast.Text = ""
txtFirst.Text = ""
txtIDNum.Text = ""
mskBalance.Mask = ""
mskBalance.Text = ""
mskBalance.Mask = "#,###.##"
mskDateTrans.Mask = ""
mskDateTrans.Text = ""
mskDateTrans.Mask = "##/##/####"

End Sub


This is the cmdFind code:


Private Sub cmdFind_Click()
Const conMsg As String = "Account numbers range from 1 to 30."
Const conBtns As Integer = vbOKOnly + vbInformation _
+ vbDefaultButton1 + vbApplicationModal
Dim udtCredit As CreditStruc, intAccNum As Integer, intUserResponse As Integer
Dim intIDNum As Integer, intIndex As Integer

On Error Resume Next

'Read record from file
Open "A:\Data.dat" For Random As #1 Len = Len(udtCredit)

intAccNum = Val(mskAccNum.Text)

If mskAccNum.Text <> "" Then
If intAccNum >= 0 And intAccNum <= 30 Then
Get #1, intAccNum, udtCredit
txtLast.Text = Trim(udtCredit.strLast)
txtFirst.Text = Trim(udtCredit.strFirst)
mskBirth.Text = Trim(udtCredit.dteBirth)
mskTelNum.Text = Trim(udtCredit.strTelNum)
txtIDNum.Text = Trim(udtCredit.intIDNum)
mskBalance.Text = Trim(udtCredit.curBalance)
mskDateTrans.Text = Trim(udtCredit.dteDateTrans)
lblDate1.Caption = Trim(udtCredit.dteDate)

Else
intUserResponse = MsgBox(conMsg, conBtns, "Unlimited Credit.")
End If
ElseIf txtLast.Text <> "" Then
For intIndex = 1 To 30
Get #1, intIndex, udtCredit
If txtLast.Text = Trim(udtCredit.strLast) Then
mskAccNum.Text = intIndex
txtLast.Text = Trim(udtCredit.strLast)
txtFirst.Text = Trim(udtCredit.strFirst)
mskBirth.Text = Trim(udtCredit.dteBirth)
mskTelNum.Text = Trim(udtCredit.strTelNum)
txtIDNum.Text = intIDNum
mskBalance.Text = curBalance
mskDateTrans.Text = Trim(udtCredit.dteDateTrans)
lblDate1.Caption = dteDate
End If
Next
End If


mskAccNum.SelStart = 0
mskAccNum.SelLength = Len(mskAccNum.Text)
mskAccNum.SetFocus
End Sub


Thankyou for any help on this point.
0
Comment
Question by:Ned_Kelly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Expert Comment

by:beckingh
ID: 6183668
Not sure exactly what you are looking for.  But one problem I have had is using the "Text" property rather than the "FormattedText" property.

Good luck.
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6184388
Hi, any error captured?

The code in cmdEnter_Click() :

For x = 1 To 30
Put #1, intAccNum, udtCredit
Next

Correct executed?



0
 
LVL 9

Accepted Solution

by:
Valliappan AN earned 300 total points
ID: 6184514
I think beckingh is right in this, since if you use a prompt character like '_' (default one), then the text property returns value including the prompt character, which also, I you can eliminate by setting the promptinclude property to false.

Cheers.
0
 

Author Comment

by:Ned_Kelly
ID: 6186339
Thanks Folks, being able to fix it so easily, I should have tried some more probing in the properties.
It was indeed the promptinclude that needed to be set to false.
Thanks again for your help.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

762 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