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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|