473,434 Members | 1,564 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

conditional statement for field in form

I am new to access.

I have a form titled "form1" with a textfield titled "code." If the textfield "code" is left blank in the form by the person submitting the form and they click submit, then I want to check the field "code" to see if it is blank (empty), and if it is, input into the table "clients" under column "client_code" the value "tem." If the field is not blank, then I would like to use whatever the user input into the field. All other fields in the form would be irrelevant as to whether they have values or not, they will be submitted as is.

Can anyone set me up in the right direction for this? Or provide me with an example?

Thanks
Richard
Aug 22 '07 #1
2 1613
JKing
1,206 Expert 1GB
I'm assuming the form is bound and that the control source for the textbox code is client_code. Use the before update event to check if the textbox is null if so set the textbox equal to "tem"

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate()
  2. If IsNull(Me.code) Then
  3. Me.code = "tem"
  4. End If
  5. End Sub
  6.  
Aug 22 '07 #2
I'm assuming the form is bound and that the control source for the textbox code is client_code. Use the before update event to check if the textbox is null if so set the textbox equal to "tem"

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate()
  2. If IsNull(Me.code) Then
  3. Me.code = "tem"
  4. End If
  5. End Sub
  6.  

Thanks a lot. It works!

Richard
Aug 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Guy Hocking | last post by:
Hi there, I have a problem in my ASP/SQL Server application i am developing, i hope you guys can help. I have a ASP form with list boxes populated by SQL tables. When a user selects a value...
0
by: Tim Graichen | last post by:
Hello, I am using the built-in conditional formatting tool in Access 2000 to disable a field (B) in my form based on the condition of another field (A) in the same form. This all works fine...
3
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
2
by: Megan | last post by:
Can you write conditional VBA code that affects only one or two records on a continuous subform? I have a form with a subform on it. The parent/ child field that links the forms is CaseID. The...
0
by: Paul T. Rong | last post by:
I don't know why that I lost track of the post. I found it from the newsgroup and paste last two posts. Pieter Linden said: "To do this - use conditional formatting..." I didn' work it out....
7
by: Shaldaman | last post by:
I have an Access form called "Login". "Command10" is a button on the form and "Text5" is a text field on it. When a user enters a value in the Text5 text field and clicks the button Command10, I...
1
by: GGerard | last post by:
Hello Is there a way to use a variable in the Conditional Formatting of a Textbox? Example : I want the background of a textbox in a continuous form to change color when the value of...
8
by: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works...
3
by: smuir | last post by:
I am working with a basic access form for a payroll system and need to modify it such that if an employee worked overtime, then their overtime payrate and hours show up on the report below their...
16
by: Art | last post by:
Can anyone help. I've tried scaling down a script to the bare minimum and it still is not working correctly. What I think should happen is that when the field app_fname is blank, that $hold_chk...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.