Form Collection Help Needed

Results 1 to 5 of 5

Thread: Form Collection Help Needed

  1. #1
    Theodore Guest

    Default Form Collection Help Needed

    Hi<BR><BR>I need help figuring out the following problem:<BR><BR>I get a runtime error 800a01f4 - Variable is undefined: &#039strConnect&#039<BR><BR>1. I have a database at: with 4<BR>fields: user_id, first, last & email<BR>2. The form is at with 3 fields:<BR>first, last & email<BR>3. The reply asp page is at<BR>with the following code:<BR><BR>&#060;% option explicit %&#062;<BR>&#060;!--#INCLUDE FILE=""--&#062;<BR>&#060;!--#INCLUDE FILE=""--&#062;<BR>&#060;html&#062;<BR>&#060;head&#062;<BR> &#060;title&#062;Thank You&#060;/title&#062;<BR>&#060;/head&#062;<BR><BR>&#060;body bgcolor="#FFFFFF"&#062;<BR>&#060;H1&#062;Thank you for subscribing to my FREE newsletter&#060;/H1&#062;<BR><BR>&#060;%<BR>&#039variables for holding user details<BR>Dim strFirstName<BR>Dim strLastName<BR>Dim strEMail<BR><BR>&#039recordset object<BR>Dim objRS<BR><BR>&#039assign values to the variables<BR>strFirstName = Request.Form("first")<BR>strLastName = Request.Form("last")<BR>strEMail = Request.Form("email")<BR><BR>&#039create recordset object and open it<BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR>objRS.Op en "customers", strConnect, adOpenStatic, adLockOptimistic,<BR>adCmdTable<BR><BR>&#039add new record<BR>objRS.AddNew<BR>objRS("first") = strFirstName<BR>objRS("last") = strLastName<BR>objRS("email") = strEMail<BR>objRS.Update<BR><BR>Response.Write "User was successfully added to the table."<BR><BR>&#039close the recordset and do clean up<BR>objRS.Close<BR>Set objRS = Nothing<BR>%&#062;<BR><BR>&#060;/body&#062;<BR>&#060;/html&#062;<BR><BR>4. The file has the following in it - all in one line:<BR>&#060;%strConnect = "Driver={Microsoft Access Driver (*.mdb)};<BR>DBQ="%&#062;<BR><BR>5. The file has the following in it:<BR>&#060;%<BR>&#039--------------------------------------------------------------------<BR>&#039 Microsoft ADO<BR>&#039<BR>&#039 (c) 1996 Microsoft Corporation. All Rights Reserved.<BR>&#039<BR>&#039<BR>&#039<BR>&#039 ADO constants include file for VBScript<BR>&#039<BR>&#039--------------------------------------------------------------------<BR><BR>&#039---- CursorTypeEnum Values ----<BR>Const adOpenForwardOnly = 0<BR>Const adOpenKeyset = 1<BR>Const adOpenDynamic = 2<BR>Const adOpenStatic = 3<BR><BR>&#039---- CursorOptionEnum Values ----<BR>Const adHoldRecords = &H00000100<BR>Const adMovePrevious = &H00000200<BR>Const adAddNew = &H01000400<BR>Const adDelete = &H01000800<BR>Const adUpdate = &H01008000<BR>Const adBookmark = &H00002000<BR>Const adApproxPosition = &H00004000<BR>Const adUpdateBatch = &H00010000<BR>Const adResync = &H00020000<BR>Const adNotify = &H00040000<BR><BR>&#039---- LockTypeEnum Values ----<BR>Const adLockReadOnly = 1<BR>Const adLockPessimistic = 2<BR>Const adLockOptimistic = 3<BR>Const adLockBatchOptimistic = 4<BR><BR>&#039---- ExecuteOptionEnum Values ----<BR>Const adRunAsync = &H00000010<BR><BR>&#039---- ObjectStateEnum Values ----<BR>Const adStateClosed = &H00000000<BR>Const adStateOpen = &H00000001<BR>Const adStateConnecting = &H00000002<BR>Const adStateExecuting = &H00000004<BR><BR>&#039---- CursorLocationEnum Values ----<BR>Const adUseServer = 2<BR>Const adUseClient = 3<BR><BR>&#039---- DataTypeEnum Values ----<BR>Const adEmpty = 0<BR>Const adTinyInt = 16<BR>Const adSmallInt = 2<BR>Const adInteger = 3<BR>Const adBigInt = 20<BR>Const adUnsignedTinyInt = 17<BR>Const adUnsignedSmallInt = 18<BR>Const adUnsignedInt = 19<BR>Const adUnsignedBigInt = 21<BR>Const adSingle = 4<BR>Const adDouble = 5<BR>Const adCurrency = 6<BR>Const adDecimal = 14<BR>Const adNumeric = 131<BR>Const adBoolean = 11<BR>Const adError = 10<BR>Const adUserDefined = 132<BR>Const adVariant = 12<BR>Const adIDispatch = 9<BR>Const adIUnknown = 13<BR>Const adGUID = 72<BR>Const adDate = 7<BR>Const adDBDate = 133<BR>Const adDBTime = 134<BR>Const adDBTimeStamp = 135<BR>Const adBSTR = 8<BR>Const adChar = 129<BR>Const adVarChar = 200<BR>Const adLongVarChar = 201<BR>Const adWChar = 130<BR>Const adVarWChar = 202<BR>Const adLongVarWChar = 203<BR>Const adBinary = 128<BR>Const adVarBinary = 204<BR>Const adLongVarBinary = 205<BR><BR>&#039---- FieldAttributeEnum Values ----<BR>Const adFldMayDefer = &H00000002<BR>Const adFldUpdatable = &H00000004<BR>Const adFldUnknownUpdatable = &H00000008<BR>Const adFldFixed = &H00000010<BR>Const adFldIsNullable = &H00000020<BR>Const adFldMayBeNull = &H00000040<BR>Const adFldLong = &H00000080<BR>Const adFldRowID = &H00000100<BR>Const adFldRowVersion = &H00000200<BR>Const adFldCacheDeferred = &H00001000<BR><BR>&#039---- EditModeEnum Values ----<BR>Const adEditNone = &H0000<BR>Const adEditInProgress = &H0001<BR>Const adEditAdd = &H0002<BR>Const adEditDelete = &H0004<BR><BR>&#039---- RecordStatusEnum Values ----<BR>Const adRecOK = &H0000000<BR>Const adRecNew = &H0000001<BR>Const adRecModified = &H0000002<BR>Const adRecDeleted = &H0000004<BR>Const adRecUnmodified = &H0000008<BR>Const adRecInvalid = &H0000010<BR>Const adRecMultipleChanges = &H0000040<BR>Const adRecPendingChanges = &H0000080<BR>Const adRecCanceled = &H0000100<BR>Const adRecCantRelease = &H0000400<BR>Const adRecConcurrencyViolation = &H0000800<BR>Const adRecIntegrityViolation = &H0001000<BR>Const adRecMaxChangesExceeded = &H0002000<BR>Const adRecObjectOpen = &H0004000<BR>Const adRecOutOfMemory = &H0008000<BR>Const adRecPermissionDenied = &H0010000<BR>Const adRecSchemaViolation = &H0020000<BR>Const adRecDBDeleted = &H0040000<BR><BR>&#039---- GetRowsOptionEnum Values ----<BR>Const adGetRowsRest = -1<BR><BR>&#039---- PositionEnum Values ----<BR>Const adPosUnknown = -1<BR>Const adPosBOF = -2<BR>Const adPosEOF = -3<BR><BR>&#039---- enum Values ----<BR>Const adBookmarkCurrent = 0<BR>Const adBookmarkFirst = 1<BR>Const adBookmarkLast = 2<BR><BR>&#039---- MarshalOptionsEnum Values ----<BR>Const adMarshalAll = 0<BR>Const adMarshalModifiedOnly = 1<BR><BR>&#039---- AffectEnum Values ----<BR>Const adAffectCurrent = 1<BR>Const adAffectGroup = 2<BR>Const adAffectAll = 3<BR><BR>&#039---- FilterGroupEnum Values ----<BR>Const adFilterNone = 0<BR>Const adFilterPendingRecords = 1<BR>Const adFilterAffectedRecords = 2<BR>Const adFilterFetchedRecords = 3<BR>Const adFilterPredicate = 4<BR><BR>&#039---- SearchDirection Values ----<BR>Const adSearchForward = 1<BR>Const adSearchBackward = -1<BR><BR>&#039---- ConnectPromptEnum Values ----<BR>Const adPromptAlways = 1<BR>Const adPromptComplete = 2<BR>Const adPromptCompleteRequired = 3<BR>Const adPromptNever = 4<BR><BR>&#039---- ConnectModeEnum Values ----<BR>Const adModeUnknown = 0<BR>Const adModeRead = 1<BR>Const adModeWrite = 2<BR>Const adModeReadWrite = 3<BR>Const adModeShareDenyRead = 4<BR>Const adModeShareDenyWrite = 8<BR>Const adModeShareExclusive = &Hc<BR>Const adModeShareDenyNone = &H10<BR><BR>&#039---- IsolationLevelEnum Values ----<BR>Const adXactUnspecified = &Hffffffff<BR>Const adXactChaos = &H00000010<BR>Const adXactReadUncommitted = &H00000100<BR>Const adXactBrowse = &H00000100<BR>Const adXactCursorStability = &H00001000<BR>Const adXactReadCommitted = &H00001000<BR>Const adXactRepeatableRead = &H00010000<BR>Const adXactSerializable = &H00100000<BR>Const adXactIsolated = &H00100000<BR><BR>&#039---- XactAttributeEnum Values ----<BR>Const adXactCommitRetaining = &H00020000<BR>Const adXactAbortRetaining = &H00040000<BR><BR>&#039---- PropertyAttributesEnum Values ----<BR>Const adPropNotSupported = &H0000<BR>Const adPropRequired = &H0001<BR>Const adPropOptional = &H0002<BR>Const adPropRead = &H0200<BR>Const adPropWrite = &H0400<BR><BR>&#039---- ErrorValueEnum Values ----<BR>Const adErrInvalidArgument = &Hbb9<BR>Const adErrNoCurrentRecord = &Hbcd<BR>Const adErrIllegalOperation = &Hc93<BR>Const adErrInTransaction = &Hcae<BR>Const adErrFeatureNotAvailable = &Hcb3<BR>Const adErrItemNotFound = &Hcc1<BR>Const adErrObjectInCollection = &Hd27<BR>Const adErrObjectNotSet = &Hd5c<BR>Const adErrDataConversion = &Hd5d<BR>Const adErrObjectClosed = &He78<BR>Const adErrObjectOpen = &He79<BR>Const adErrProviderNotFound = &He7a<BR>Const adErrBoundToCommand = &He7b<BR>Const adErrInvalidParamInfo = &He7c<BR>Const adErrInvalidConnection = &He7d<BR>Const adErrStillExecuting = &He7f<BR>Const adErrStillConnecting = &He81<BR><BR>&#039---- ParameterAttributesEnum Values ----<BR>Const adParamSigned = &H0010<BR>Const adParamNullable = &H0040<BR>Const adParamLong = &H0080<BR><BR>&#039---- ParameterDirectionEnum Values ----<BR>Const adParamUnknown = &H0000<BR>Const adParamInput = &H0001<BR>Const adParamOutput = &H0002<BR>Const adParamInputOutput = &H0003<BR>Const adParamReturnValue = &H0004<BR><BR>&#039---- CommandTypeEnum Values ----<BR>Const adCmdUnknown = &H0008<BR>Const adCmdText = &H0001<BR>Const adCmdTable = &H0002<BR>Const adCmdStoredProc = &H0004<BR><BR>&#039---- SchemaEnum Values ----<BR>Const adSchemaProviderSpecific = -1<BR>Const adSchemaAsserts = 0<BR>Const adSchemaCatalogs = 1<BR>Const adSchemaCharacterSets = 2<BR>Const adSchemaCollations = 3<BR>Const adSchemaColumns = 4<BR>Const adSchemaCheckConstraints = 5<BR>Const adSchemaConstraintColumnUsage = 6<BR>Const adSchemaConstraintTableUsage = 7<BR>Const adSchemaKeyColumnUsage = 8<BR>Const adSchemaReferentialContraints = 9<BR>Const adSchemaTableConstraints = 10<BR>Const adSchemaColumnsDomainUsage = 11<BR>Const adSchemaIndexes = 12<BR>Const adSchemaColumnPrivileges = 13<BR>Const adSchemaTablePrivileges = 14<BR>Const adSchemaUsagePrivileges = 15<BR>Const adSchemaProcedures = 16<BR>Const adSchemaSchemata = 17<BR>Const adSchemaSQLLanguages = 18<BR>Const adSchemaStatistics = 19<BR>Const adSchemaTables = 20<BR>Const adSchemaTranslations = 21<BR>Const adSchemaProviderTypes = 22<BR>Const adSchemaViews = 23<BR>Const adSchemaViewColumnUsage = 24<BR>Const adSchemaViewTableUsage = 25<BR>Const adSchemaProcedureParameters = 26<BR>Const adSchemaForeignKeys = 27<BR>Const adSchemaPrimaryKeys = 28<BR>Const adSchemaProcedureColumns = 29<BR>%&#062;<BR><BR>Thanks for any help you can offer.<BR><BR>Theodore<BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Form Collection Help Needed

    Your .Open line is wrong:<BR><BR>&#062;objRS.Open "customers", strConnect, adOpenStatic, &#062;adLockOptimistic,<BR><BR>Maybe I&#039m just to simplistic but to connect to an Access<BR>DB I just use something like:<BR><BR>objRS.Open "customers"<BR><BR>All that other stuff isn&#039t really necessary for an access DB<BR>some of the other more complex ODBC types such as Oracle and<BR>SQL server need more info. I use ORacle, here&#039s a normal<BR>Open line to Oracle:<BR><BR>objRS.Open "odbc_name","username","password"<BR><BR>Where odbc_name is the name of the ODBC link NOT necessarily<BR>the name of the database or file.<BR><BR>hope this helps.<BR><BR> - jack<BR><BR>

  3. #3
    alex ( Guest

    Default RE: Form Collection Help Needed

    No, actually i think the following line is correct:<BR>objRS.Open "customers", strConnect, adOpenStatic, adLockOptimistic, adCmdTable<BR><BR>These are just properties of the Recordset object. I don&#039t see any problems with these. I could be wrong, but the problem appears to be with the include file Within in that file you have DBQ= . This can&#039t be correct because the DBQ value must be the location of your Access database file, not an html file such as the one you have specified. And also, the path to the Access database must be a physical path, not a URL. Something like DBQ=D:inetpubdatabasemydatabase.mdb . If you don&#039t know the physical path then ask somebody who would. This should alleviate your problem.

  4. #4
    lk Guest

    Default RE: Form Collection Help Needed

    Actually.. you haven&#039t declared the strConnect var.<BR>You could change the file to look something like this:<BR>&#060;%<BR>dim strConnect<BR>strConnect = "Driver={Microsoft Access Driver (*.mdb)};<BR>DBQ="<BR>%&#062;<BR><BR>--<BR>

  5. #5
    Join Date
    Dec 1969

    Default RE: Form Collection Help Needed

    This is true.... since Option Explicit was the first line in the code, strConnect must be declared, and this was the source of the error.... however, the page still won&#039t work due to the fact that this DSN-less connection is trying to use an Access database file but lists an html file as the DBQ.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts