RE: Using query values for field name in table



Hi, 69 Camaro,
Tx.
"Proc" is a caption given to acalculated field in the query
"qryProcSpecImport".
That is the crux of my problem, what are the properties of a field in a
query? Is it even appropriate to call it a "field"? Whereas a field is a
field in a table. And knowing that, how does one extract its value? I
realize I'm not talking in computerese, so I'm sorry if the concepts I'm
discussing are confusing.
And then, should fldName be defined as a string variable which I can then
use to insert as a fieldname, or are there specific qualities of a variable
defined as a "field" which I need to maintain?
Rocky

"'69 Camaro" wrote:

> Hi, Rocky.
>
> Proc has not been defined as a DAO.Field object type and, unless it's a
> global variable or module-level variable and you've assigned it a value
> outside of this procedure, it hasn't been initialized before being assigned
> to the "fldName" Field, which will present another problem after you fix
> Proc's object type.
>
> If you haven't set Option Explicit in your modules (which appears to be the
> case), then Proc is a Variant.
>
> HTH.
> Gunny
>
> See http://www.QBuilt.com for all your database needs.
> See http://www.Access.QBuilt.com for Microsoft Access tips.
>
> (Please remove ZERO_SPAM from my reply E-mail address so that a message will
> be forwarded to me.)
> - - -
> If my answer has helped you, please sign in and answer yes to the question
> "Did this post answer your question?" at the bottom of the message, which
> adds your question and the answers to the database of answers. Remember that
> questions answered the quickest are often from those who have a history of
> rewarding the contributors who have taken the time to answer questions
> correctly.
>
>
> "Rocky" wrote:
>
> > I have a long list of numbers and names which I imported from a .pdf file.
> > In the .pdf file they were a single string. After stripping off unprintable
> > characters and separating the numbers and names with a query, I want to use
> > each name for a field name in a separate table. My problem is getting the
> > code to find the field in the query (a calculated value) and store the value
> > to a variable which I can then use as a field name. Following is the code:
> > Sub CreateTableDefX()
> >
> > Dim dbsGeneralThoracic As Database
> > Dim tdfNew As TableDef
> > Dim prpLoop As Property
> > Dim fldName As Field
> >
> > Dim recno As Long
> > Set dbsGeneralThoracic = CurrentDb
> >
> > Set dbsGeneralThoracic = OpenDatabase("I:\Database\Thoracic
> > database\General Thoracic.mdb")
> > DoCmd.OpenQuery "qryProcSpecImport"
> >
> > ' Create a new TableDef object.
> > Set tdfNew = dbsGeneralThoracic.CreateTableDef("tblProcedures")
> > recno = 1
> >
> > Do While recno < 125
> > DoCmd.GoToRecord acDataQuery, "qryProcSpecImport", acNext, recno
> >
> > Set fldName = Proc
> >
> > On the last line above is where I get the error message, "Compile error:
> > type mismatch"
> >
> > Help!
.



Relevant Pages

  • RE: Breaking down imported information
    ... Single-record append query: ... ' Check if at EOF of Recordset (rsDataViaCode) ... ' if at EOF Exit Do. ... Dim rsDataViaCode As DAO.Recordset ...
    (microsoft.public.access.modulesdaovba)
  • Re: LDAP query information
    ... Copyright 1985-2001 Microsoft Corp. ... Dim strBase, strFilter, strAttributes, strQuery, adoRecordset ... Set adoConnection = CreateObject ... ' Construct LDAP syntax query. ...
    (microsoft.public.windows.server.scripting)
  • Re: LDAP query information
    ... Dim strBase, strFilter, strAttributes, strQuery, adoRecordset ... Set adoConnection = CreateObject ... ' Construct LDAP syntax query. ... Yes, the script uses ADO to query AD directly, which is very efficient - no ...
    (microsoft.public.windows.server.scripting)
  • Re: Need WMI script
    ... I also assume that strGroupName is ... If instead strDomainName is the NetBIOS name of a domain, ... Dim adoCommand, adoConnection, strBase, strFilter, strAttributes, xmlDoc, ... ' Construct the LDAP syntax query. ...
    (microsoft.public.windows.server.scripting)
  • Re: Make Table Query - Sorting Errors
    ... Dim OutputTable As DAO.Recordset ... The query to concatenate the CAMPNO values will need to be LOOKING at the ... If you post the query you are using to do this, I beleive we can get it to ... Is there a command that I can use in the module code to first sort the ...
    (microsoft.public.access.queries)