You are here:

Using MS Access/Textbox in an Update Form

Advertisement


Question
QUESTION: I have 2 text boxes in my updatable form that I want ask about.
1st one is "Register Date" and the other is "Actual Date".

How can I create the "Actual Date" to run my code before I go to another text box to input other data (this is a a NEW RECORD page of the form)?
The code is: IIf([Register Date] = Now(), [Register Date], "")

In the same time, I want the "Actual Date" remain unchanged for all the previous records. And also, I want the "Actual Date" to update the linked table after I accepted the data displayed in the "Actual Date" after it run my code.


ANSWER: First, the condition will never be true. Now() changes every tenth of a second. Second, I'm not positive what you are trying to do. What does this app do, what does the table you are binding the form to capture? I can understand what Register Date could be, but I'm not following what Actual date would be.

Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

---------- FOLLOW-UP ----------

QUESTION: Actual Date is the date that we received the document. While Register Date is the date that we register the document into the database. Here we could retrieve any date lapse if any.
My intention is if the Actual Date is same as the Register Date, I do not want to key-in again the same date but automatically update similarly to the Register Date. If the record is different, then leave Actual Blank so I could key-in manually.

Answer
You still are making this clear. what you are saying doesn't sound logical.

If you are saying that the Register Date may be the same as the Actual Date and when it us you don't want to key in the same date twice, that makes sense and is easy to do. In the After Update of the Register control just set the Actual Date control to what was keyed inot the Register Date control:

Me.ActualDate = Me.RegisterDate

Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

©2012 About.com, a part of The New York Times Company. All rights reserved.