Update field using (Iff) statement.

G

Guest

Hello, using Access 2003 form, I am seeking the correct (IFF) statement to
enable [Transaction Type] field to populate with the text “Main Log†after
the field name [Receiving Time] data is enter. Please inform on where the
(IFF) statement should be entered and will “Main Log†update to the table?
 
J

John Vinson

Hello, using Access 2003 form, I am seeking the correct (IFF) statement to
enable [Transaction Type] field to populate with the text “Main Log” after
the field name [Receiving Time] data is enter. Please inform on where the
(IFF) statement should be entered and will “Main Log” update to the table?

Does the [Transaction Type] always equal "Main Log" if [Receiving
Time] is non-NULL? If so, perhaps it should not exist at all, since it
can be derived from the value of the other field.

If it is variable but whatever is there should be overwritten whenever
[Receiving Time] is entered, you can use the AfterUpdate event of
[Receiving Time]:

Private Sub Receiving_Time_AfterUpdate()
Me![Transaction Type] = "Main Log"
End Sub

An IIF statement would not help in this particular case, unless I'm
misunderstanding the situation.

John W. Vinson[MVP]
 
G

Guest

You talk about Forms and Fields. Forms do not have fields, they have
controls. Tables have fields. I am assuming you are talking about the text
boxes you enter the data in. So, lets call them txtRecevingTime amd
txtTransType. In the Lost Focus event of txtReceivingTime put something like
this:
Me.txtTransType = "Main Log"

A couple of thing here:
1. Get out of the habit of putting spaces in names. It can really cause you
problems
use something like [TransactionType] or [Transaction_Type]
2. What if there are more than one transaction type? This is maybe why you
want an IIf statment?
 
G

Guest

John and Klatuu, thank you for responding. I have acquired important
information which I will apply to my data base. I initial apply John
example and I am thankful that I am now able to run a query to identified
which record number correlates with the appropriate form.

John Vinson said:
Hello, using Access 2003 form, I am seeking the correct (IFF) statement to
enable [Transaction Type] field to populate with the text “Main Log†after
the field name [Receiving Time] data is enter. Please inform on where the
(IFF) statement should be entered and will “Main Log†update to the table?

Does the [Transaction Type] always equal "Main Log" if [Receiving
Time] is non-NULL? If so, perhaps it should not exist at all, since it
can be derived from the value of the other field.

If it is variable but whatever is there should be overwritten whenever
[Receiving Time] is entered, you can use the AfterUpdate event of
[Receiving Time]:

Private Sub Receiving_Time_AfterUpdate()
Me![Transaction Type] = "Main Log"
End Sub

An IIF statement would not help in this particular case, unless I'm
misunderstanding the situation.

John W. Vinson[MVP]
 

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