Do not use on any
shared computer
September 8, 2008 10:01am pdt
 
[x]
Attachment Details

EXPRESSION BUILDER

Tags: MICROSOFT ACCESS 2007, MS, 2007
Hi guys.

Right i have a form with a tick box labelled [IN STOCK]
i also have a a field called [date packed]

using expression builder i would like to write an expression that when [in stock] is ticked a the date is inserted in to the [date packed] field

again i am very new to this hence i would like try and write it in expression builder.

Cheers guys
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Software
Question Asked By: davidwalters
Solution Provided By: koutny
Participating Experts: 2
Solution Grade: A
Views: 63
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by koutny

Rank: Guru

Expert Comment by koutny:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by peter57r

Rank: Genius

Expert Comment by peter57r:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by davidwalters
Author Comment by davidwalters:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by koutny

Rank: Guru

Expert Comment by koutny:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by davidwalters
Author Comment by davidwalters:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by koutny

Rank: Guru

Accepted Solution by koutny:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Open Discussion
Open Discussion
 
Comment by davidwalters
im trying to use this again for another field but i get an error.. null function not allowed any ideas?

when you enter a delivery note i want the date to appear in the delassigndate field
when you remove the number from the delivery note i want the date to be removed..
1:
2:
3:
4:
5:
6:
7:
8:
Private Sub delivery_note_number_AfterUpdate()
    If Me![delivery note number] Then
        If IsNull(Me![delassigndate]) Then Me![delassigndate] = Date 'only set the date if the field is empty (null)
    Else
         
         Me![delassigndate] = Null
    End If
End Sub
Open in New Window Select All
 
 
Comment by koutny
you will probably need to change the condition for checking whether the delivery note number has been entered:

Private Sub delivery_note_number_AfterUpdate()
    If not isnull(Me![delivery note number]) and Me![delivery note number] <> "" Then
        If IsNull(Me![delassigndate]) Then Me![delassigndate] = Date 'only set the date if the field is empty (null)
    Else
         
         Me![delassigndate] = null
    End If
End Sub
 
 
Comment by davidwalters
koutny you are the man!
Can you explain the code for me?

i undertsand the basics.. i just didnt want to just copy and paste it...

Thanks again :D
 
 
Comment by koutny
An if command expects a boolean expression which can be evaluated to either true of false. With a check box you can pass its value as a boolean expression because Yes/No can be easily translated to true/false.

With a text box I don't think there is a direct translation of its value to true/false (there would be in C++ but this is Visual Basic). So you need to use the isnull function which returns a true/false value. What can also happen with a text value is that it can be an empty string which is not a null value but doesn't count as a valid string for your purposes either (hence the second part of the condition)

I didn't ask where the error you were getting occured. It might be possible that you get an error when you try to clear the delassigndate field by setting it to null - you would get an error if this field is marked as required in the table design.
 
 
Comment by davidwalters
koutny i undestand now.. with a check box you automatically a yes no response where as a text box you dont.. which makes sense.. excellent.. i only wish i had assigned this as a new question so you can some more points in return.. thanks again koutny you have been again most helpfull
 
 
Comment by koutny
you're welcome
 
 
20080723-EE-VQP-34 / EE_QW_2_20070628