Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

I cant retreive the values from the maskedit boxes

Posted on 2001-06-12
4
Medium Priority
?
179 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

636 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