A Microsoft Office (Excel, Word) forum. OfficeFrustration

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. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Table Default Values



 
 
Thread Tools Display Modes
  #1  
Old December 16th, 2009, 11:17 PM posted to microsoft.public.access.forms
The Brat[_2_]
external usenet poster
 
Posts: 1
Default Table Default Values

Is it possible to set the default value of a field in the table to either a
value entered into a message box or a value entered into another table?

I'm importing data from a text file into an existing table. I have been
manually changing the default value for the report date field each time I
import a new report, but since I won't be doing the importing anymore, would
like to automate or simplify this process.

Any suggestions?
  #2  
Old December 16th, 2009, 11:35 PM posted to microsoft.public.access.forms
Clifford Bass[_2_]
external usenet poster
 
Posts: 1,295
Default Table Default Values

Hi,

If you want the current date you can just use =Date(). If some other
date, you can do something like this:

Public Function LoadSummaries() As Boolean

Dim strInput As String

LoadSummaries = False

strInput = InputBox("Enter summary as-of date:")
If IsDate(strInput) Then

CurrentDb.TableDefs("tblRequisition_Summary_Data") .Fields("Summary_Date" _
).DefaultValue = "#" & strInput & "#"
DoCmd.OpenQuery "qryUse for Adding Data", acViewNormal, acAdd
LoadSummaries = True
Else
If strInput "" Then
MsgBox """" & strInput & """ is not a valid date.",
vbExclamation + _
vbOKOnly
End If
End If

End Function

In this case the query showed the table without the summary date and in
add mode. The user then copied the data from a web site and paste-appended
the new data into the table.

Hope that helps,

Clifford Bass

"The Brat" wrote:

Is it possible to set the default value of a field in the table to either a
value entered into a message box or a value entered into another table?

I'm importing data from a text file into an existing table. I have been
manually changing the default value for the report date field each time I
import a new report, but since I won't be doing the importing anymore, would
like to automate or simplify this process.

Any suggestions?

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.