Formatting

A

Ann

I'm not a programmer but can alter code I find. I have the following code in
an "On Not In List" event:

Private Sub cboFirstClassPostageRate_NotInList(NewData As String, Response
As Integer)

Dim intResponse As Integer

MsgBox "New First Class Postage Rate: '" & NewData & "'"
If MsgBox("The First Class Postage Rate you've entered '" & NewData & "'
is not in the First Class Postage Rate list." & vbCrLf & vbCrLf & _
"Do you want to add this First Class Postage Rate to the list?",
vbQuestion + vbYesNo) = vbYes Then

'We're going to add this First Class Postage Rate to the First Class
Postage Rate table.
Call basFirstClassPostageRates.AddFirstClassPostageRate(NewData)
'Signal that we have added this First Class Postage Rate.
intResponse = acDataErrAdded
Else
'Signal that we don't want to add this First Class Postage Rate.
intResponse = acDataErrContinue
End If

Response = intResponse

End Sub

It calls:

Public Function AddFirstClassPostageRate(curFirstClassPostageRate As String)

Dim strSQL As String

'Build the SQL to add the First Class Postage Rate to the table.
'Finished SQL looks like this:
'INSERT INTO tblFirstClassPostageRates (curFirstClassPostageRate)
strSQL = ""
strSQL = strSQL & " INSERT INTO tblFirstClassPostageRates
(curFirstClassPostageRate)"
strSQL = strSQL & " SELECT '" & curFirstClassPostageRate & "' ; "

'Run the SQL to add the person.
CurrentDb.Execute strSQL


End Function

The problem is that this is for a string and the field I'm trying to enter
the new data into is currency. How do I format this, or change to code so it
accepts the data without having to type everything. Example: I have to type
$0.45 and I only want to type .45 but have it appear in the table as $0.45.
Thanks for any help you can give me.
 
D

Dorian

The InputMask property controls how data is entered in a form control. The
Format property controls how data is displayed in a form control.
Possibly all you need do is to change the imput mask. However, if you change
it from currency, then the user could enter data that is potentially not a
currency amount and then you would get an error. Look up InputMask in Access
HELP.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top