John,
I'm trying to use that as part of a filename in a transfer spreadsheet. Here is the code:
Dim stDocName As String
Dim MyForm As Form
stDocName = DLookup("TrailerDesc", "TempVIN")
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acTable, stDocName, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
"qryExportTempVIN", "S:\Licensing\" & Format(Date, "yyyy") & "\" & stDocName & _
".xls"
MsgBox _
"An Excel Spreadsheet has been created. It is S:\Licensing\TempVIN_mm_dd_yyyy.xls"
DoCmd.SelectObject acForm, MyForm.Name, False
Doyce---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
On Oct 1, 2014, at 7:43 PM, winberry.doyce@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:Duane,
It actually shows the contents of the field I want which is the description of the trailer but I didn't think anyone would know what that meant so I substituted Trailer Description in my question.
Doyce
---In MS_Access_Professionals@yahoogroups.com, <duanehookom@...> wrote :Doyce,
I'm not sure why your error states "Trailer Description" when this is not in your DLookup("TrailerDesc", "TempVIN") . Are you getting confused by field captions?
Duane Hookom MVP
MS Access (2001-2014)
To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Wed, 1 Oct 2014 10:13:27 -0700
Subject: [MS_AccessPros] Dlookup Criteria
Hello Friends,
I'm trying to use DLookUp to return the value in a description field from a temp table where all records will have the same description in the field. Here is what I have DLookup("TrailerDesc", "TempVIN") but I don't know what to put in the criteria. Any record will do. There is a recordID which is the primary key. It is autonumber. I'm getting an error that says "My database cannot find the Trailer Description you referenced in the Object Name argument".
Doyce
Posted by: winberry.doyce@roadsysinc.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Tidak ada komentar:
Posting Komentar