A
ArielZusya
I'm using DoCmd.TransferSpreadsheet to import data from an excel
spreadsheetinto my tblMain. The data in the spreadsheet contains something
like:
FirstName LastName RefNum
The RefNum associated with all the FirstName and LastName entries will be
the same for a given imported excel spreadsheet. In other words the data
might look something like:
Jane Doe 32CGD221
John Smith 32CGD221
etc.
I then use:
INSERT INTO tblRef ( RefNum )
SELECT DISTINCT RefNum
FROM tblMain;
There is a one : Many relationship between each record in tblRef and each of
the many records imported into tblMain. tblRef also contains a feild for a
description of each RefNum. I'd like to open a form, immediately after
importing the data and instering the unique RefNum into tblRef, which brings
up that most recently imported RefNum and allows me to enter a description.
The way this all happens so far is I've got an "Import" button on a menu
form. When clicked, the code looks something like this:
Dim stDocName As String
Dim stTableName As String
Dim stFormName As String
Dim stLinkCriteria As String
stDocName = "qryInsertRefNum"
stTableName = "tblMain"
stFormName = "frmDescriber"
DoCmd.Close
DoCmd.SetWarnings = False
DoCmd.TransferSpreadsheet acImport, , stTableName, OpenExcelFile, True
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings = True
DoCmd.OpenForm stDocName, , , stLinkCriteria
I've got that stLinkCriteria (which the system adds to any wizzarded button
to open a form) so I thought I might take advantage of it but I'm not sure
what the criteria would be or even if that is the rigth way to go about this.
Your help is greatly appreciated! Thanks!
spreadsheetinto my tblMain. The data in the spreadsheet contains something
like:
FirstName LastName RefNum
The RefNum associated with all the FirstName and LastName entries will be
the same for a given imported excel spreadsheet. In other words the data
might look something like:
Jane Doe 32CGD221
John Smith 32CGD221
etc.
I then use:
INSERT INTO tblRef ( RefNum )
SELECT DISTINCT RefNum
FROM tblMain;
There is a one : Many relationship between each record in tblRef and each of
the many records imported into tblMain. tblRef also contains a feild for a
description of each RefNum. I'd like to open a form, immediately after
importing the data and instering the unique RefNum into tblRef, which brings
up that most recently imported RefNum and allows me to enter a description.
The way this all happens so far is I've got an "Import" button on a menu
form. When clicked, the code looks something like this:
Dim stDocName As String
Dim stTableName As String
Dim stFormName As String
Dim stLinkCriteria As String
stDocName = "qryInsertRefNum"
stTableName = "tblMain"
stFormName = "frmDescriber"
DoCmd.Close
DoCmd.SetWarnings = False
DoCmd.TransferSpreadsheet acImport, , stTableName, OpenExcelFile, True
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings = True
DoCmd.OpenForm stDocName, , , stLinkCriteria
I've got that stLinkCriteria (which the system adds to any wizzarded button
to open a form) so I thought I might take advantage of it but I'm not sure
what the criteria would be or even if that is the rigth way to go about this.
Your help is greatly appreciated! Thanks!