Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 07-02-2009, 09:40 AM
adgjqetuo adgjqetuo is offline
Registered User
 
Join Date: 06 Aug 2007
Posts: 87
adgjqetuo is becoming part of the community
Transfer from text box to field

Please Register to Remove these Ads

I'm very new to access - so please bare with me here (I'm more of an excel guy)

I have a database with a form. When you click the button on the form, it opens an input box which asks you to "enter the date in YYYYMMDD format"

Once you enter 07012009 it looks up a text file in a specific folder with that same end trail, then imports it with specific delimited specs I have pre-set.

It then imports all the records into it new individual table (using the end date trail) but also dumps it into a master table as well.


Okay - so knowing this - heres my quesiton:

How do can I get the input box "YYYYMMDD" into the column called "Date imported" within the master table and formated as "MM/DD/YYYY". Also, how can I get it to automatically put the text "IMPORT FILE" in the column called "Media" for each record?

It's VERY important that it only does this for the imported records. Is this possible?

Here is the code I have so far:

Code:
Private Sub Command1_Click()
Dim Importdate As String
On Error GoTo Errormsg
Importdate = InputBox("Please date of text file (YYYYMMDD):")
DoCmd.TransferText acImportDelim, "textfile", "textfile_" & Importdate, "S:\Brochure_" & Importdate & ".txt", N
DoCmd.TransferText acImportDelim, "Textfile", "MasterTable", "S:\Brochure_" & Importdate & ".txt", N

MsgBox ("Complete!")
Errormsg:
If Err.Number = 3011 Or Err.Number = 13 Then
MsgBox ("Please try again!")
End If
End Sub
Also - everything I have works so far, I just need to add the features I said above.


Thanks!!
Reply With Quote
  #2  
Old 07-02-2009, 09:43 AM
split_atom18 split_atom18 is offline
Forum Contributor
 
Join Date: 23 Apr 2009
Location: Fredericksburg, IA
MS Office Version:Ultimate 2007
Posts: 126
split_atom18 Has established their mark in the community
Re: Transfer from text box to field

I ask this question to most people, what version of Access? Lots of things change in access from version to version.
__________________
"I am not a rocket scientist, I am a nuclear engineer." - Split_atom18
If my advice has been helpful to you, then please help me by clicking on the scales and adding to my reputation, Thanks!
Reply With Quote
  #3  
Old 07-02-2009, 09:52 AM
adgjqetuo adgjqetuo is offline
Registered User
 
Join Date: 06 Aug 2007
Posts: 87
adgjqetuo is becoming part of the community
Re: Transfer from text box to field

Thanks for the quick reponse! I have Access 2003
Reply With Quote
  #4  
Old 07-02-2009, 01:20 PM
split_atom18 split_atom18 is offline
Forum Contributor
 
Join Date: 23 Apr 2009
Location: Fredericksburg, IA
MS Office Version:Ultimate 2007
Posts: 126
split_atom18 Has established their mark in the community
Re: Transfer from text box to field

I would use an Update Query to add the data you want to each column that you want to update. Then call the Update Query from the code.

Hope this helps,

Dan
__________________
"I am not a rocket scientist, I am a nuclear engineer." - Split_atom18
If my advice has been helpful to you, then please help me by clicking on the scales and adding to my reputation, Thanks!
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump