Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

Form with automatic field values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pedro - 16 May 2007 16:24 GMT
Hello everyone
I have the main form called Table Dados where i enter all data i need and
one of the field, VALUEPREP,  it's suppose to do this :
If [Comis] is FALSE
   then 0
ELSE
  (IF [VALVEND] IS Between 0 and 30)
       Then 5€
  (IF [VALVEND] IS Between 31 and 50)
       Then 10€
  (IF [VALVEND] IS Between 51 and 90)
       Then 15€
  and so on ... (is it better to have a table for this numbers 30, 50, 90
etc?)
ENDIF

I don't understand much of access so please try to explain me like i'm 10
years old pls.
Any help it's very apreciated
Tks in advance
Pedro
Klatuu - 16 May 2007 17:04 GMT
Where are you trying to use this code?  It looks like a mixture of VBA and
SQL, but not exacly either.
If you can tell me what you are doing, I can help get it to work for you.
Signature

Dave Hargis, Microsoft Access MVP

> Hello everyone
> I have the main form called Table Dados where i enter all data i need and
[quoted text clipped - 17 lines]
> Tks in advance
> Pedro
Pedro - 18 May 2007 14:08 GMT
Hi Klatuu
I guess that's a mix of what you've said, but it's what i would like to, in
theory, one of the fields to do, VALUEPREP. This field, before anything,
gotta check if a field called [Comis] is true or false. In case it's false,
value 0, but if not, have to check another field, [Valvend], and there are
only 5 or 6 possibilities (Between 0 and 30, between 31 and 50 ...) . If
first, then 5, if 2nd, then 10 and so on.
Hope i was clear enough for you. Please help me but don't forget to do it
like i'm 10 years old.
Tks in advance
Pedro

> Where are you trying to use this code?  It looks like a mixture of VBA and
> SQL, but not exacly either.
[quoted text clipped - 21 lines]
> > Tks in advance
> > Pedro
Klatuu - 18 May 2007 14:22 GMT
I understand, but where will this code be? In a procedure (sub or function),
an SQL query?
When you say "field", do you mean a field in a recordset/table, or controls
on a form?
Signature

Dave Hargis, Microsoft Access MVP

> Hi Klatuu
> I guess that's a mix of what you've said, but it's what i would like to, in
[quoted text clipped - 33 lines]
> > > Tks in advance
> > > Pedro
Pedro - 22 May 2007 17:25 GMT
Sorry for the delay ... i meant for a field on a form

> I understand, but where will this code be? In a procedure (sub or function),
> an SQL query?
[quoted text clipped - 38 lines]
> > > > Tks in advance
> > > > Pedro
Klatuu - 22 May 2007 17:35 GMT
Well, Pedro, terminology is a bit mixed here.  Although you will see it
incorrectly used even by Microsoft, forms do not have fields, they have
controls.  Fields are properties of tables or queries.

In any case, the best way to do this is with a Select Case statment.

If Not Me.Comis Then
   Me.VALUEPREP = 0
ELSE
   Select Case Me.VALVEND
       Case 0 to 30
           Me.VALUEPREP = 5€
       Case 31 to 50
           Me.VALUEPREP = 10€
       Case 51 to 90
           Me.VALUEPREP = 15€
       'And So On
       Case Else
           MsgBox "No Valid Number"
    End Select
ENDIF

Where the code will go I can't tell you because you did not provide enough
information.

Signature

Dave Hargis, Microsoft Access MVP

> Sorry for the delay ... i meant for a field on a form
>
[quoted text clipped - 40 lines]
> > > > > Tks in advance
> > > > > Pedro
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.