User Input once Imported data

Lensmeister

Registered User.
Local time
Today, 12:52
Joined
Feb 18, 2009
Messages
65
Hi,

Hope this makes sense and it is in the correct section. I am using Access 2002.

I am going to be producing a macro that imports a txt file. Once the text file is imported there will be a empty field for a date value. Nothing in the file that is being imported will have a date in it.

I would like to (if possible) to, once the file is in the table, open an input box asking the user for a date (formated as YYYY-MM-DD) and once the date has been entered and the ok button pressed it inputs that date in to all records in the date field.

Is this possible and what would be hte best way to code it?

Thanks in advance.
 
A date field is actually numeric, not text which is what you input box will return. So the first question is, are you storing the date as a date or a text field?

The other problem is you will also need to introduce data validation to ensure the date is the right format and timescale which means looping on the input box until it is valid.

A better solution would be to have an unbound control on your form for the user to enter the date - you can then use the formatting and data validation of the control to do this for you.

Further, you can disable the button that starts the import until a valid date has been entered so the user does not need to hang around until the import is completed before entering the date.

If this solution is acceptable then do the folllowing:

1. in the form current event put
mybutton.enabled=false (where my button is the name of the button that starts the import)

2. create a new unbound control called frmDate and set its format, input mask and validation as required

3. in the frmDate afterupdate event put
myButton.enabled=true

4. in the mybutton on click event you will already have code to import the data. After this code put
currentdb.execute("UPDATE myTbl SET myDate= " & frmDate & " WHERE myDate Is Null")
 
Thanks CJ_London.

I may have to go back to the drawing board on this one.
 

Users who are viewing this thread

Back
Top Bottom