Click here to Skip to main content
15,887,267 members
Home / Discussions / Database
   

Database

 
GeneralRe: Remote Connection MSSQL [modified] Pin
confusedme4-Oct-07 23:15
confusedme4-Oct-07 23:15 
QuestionGeneral Network Error. Check your network documentation Pin
Mayank Prajapati3-Oct-07 19:29
Mayank Prajapati3-Oct-07 19:29 
QuestionChanging table name to a table variable Pin
MAW303-Oct-07 17:13
MAW303-Oct-07 17:13 
AnswerRe: Changing table name to a table variable Pin
Joe3-Oct-07 20:17
Joe3-Oct-07 20:17 
AnswerRe: Changing table name to a table variable Pin
Marek Grzenkowicz3-Oct-07 23:00
Marek Grzenkowicz3-Oct-07 23:00 
QuestionHow secure is ADO.Net traffic? Pin
adambl3-Oct-07 11:46
professionaladambl3-Oct-07 11:46 
AnswerRe: How secure is ADO.Net traffic? Pin
Paul Conrad3-Nov-07 7:51
professionalPaul Conrad3-Nov-07 7:51 
QuestionCurrent record does not support updating... Pin
new_phoenix3-Oct-07 11:36
new_phoenix3-Oct-07 11:36 
I have Error Message #3251 that occurs when I try to update one of the fields from one table based upon the value stored in another table. I am trying to compare the values of several fields in each of two tables, and when there is a match, I would like to assign the value of the second table to the value of the first table. When all records have had assignments, then I would perform a link between the first table and another table in the database, and then export the results with a portion of the data from each of the two tables in a query. Seems easier than trying to match a composite key from one table against a composite key from the other table. Besides, I don't think it is possible to compare composite keys. It seems better to merely compare indexes.

Why doesn't it permit me to update the first table based upon results from the second table? I believe it has something to do with the Lock Type because the error message states: "Error and Error #3251: ADODB.Recordset: Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype." I need some assistance here.

Here is the code so far:

Private Sub ProcessHeadcountRecords()
    Dim dbsHeadcount As Database
    Dim Cnxn As ADODB.Connection
    Dim strConn As String
    Dim rstInputFile As ADODB.Recordset
    Dim cmdSQLInputFile As ADODB.Command
    Dim strSQLInputFile As String
    Dim rstHyperionMany As ADODB.Recordset
    Dim cmdSQLHyperionMany As ADODB.Command
    Dim strSQLHyperionMany As String
    Dim rstHyperionOne As ADODB.Recordset
    Dim cmdSQLHyperionOne As ADODB.Command
    Dim strSQLHyperionOne As String
    Dim strDBPath As String
    Dim strFileName As String
    Dim strMessage As String
    Set dbsHeadcount = CurrentDb
    
    Set cmdSQLInputFile = New ADODB.Command
    Set cmdSQLInputFile.ActiveConnection = Application.CurrentProject.Connection
    strSQLInputFile = "SELECT [COUNTRY], [TYPE], [BUSINESS UNIT], " & _
        "[L/R/G], [REGION], [JOB FUNCTION], [09/12/2007 Reported], " & _
        "[NUMINDEX] FROM [TBLINPUTFILE]"
    cmdSQLInputFile.CommandType = adCmdText
    cmdSQLInputFile.CommandText = strSQLInputFile
    Set rstInputFile = cmdSQLInputFile.Execute()
    rstInputFile.MoveFirst
    
    Set cmdSQLHyperionMany = New ADODB.Command
    Set cmdSQLHyperionMany.ActiveConnection = Application.CurrentProject.Connection
    strSQLHyperionMany = "SELECT [COUNTRY], [TYPE], [BUSINESS UNIT], " & _
        "[L/R/G], [REGION], [JOB FUNCTION], [NUMFOREIGNKEY], [09/12/2007 Reported] " & _
        "FROM [TBLHYPERIONMANY]"
    cmdSQLHyperionMany.CommandType = adCmdText
    cmdSQLHyperionMany.CommandText = strSQLHyperionMany
    Set rstHyperionMany = cmdSQLHyperionMany.Execute()
    
    Do Until rstInputFile.EOF
        With dbsHeadcount
            strSQLHyperionMany = "SELECT [COUNTRY], [TYPE], " & _
                "[BUSINESS UNIT], [L/R/G], [REGION], [JOB FUNCTION], " & _
                "[NUMFOREIGNKEY], [09/12/2007 Reported] " & _
                "FROM [TBLHYPERIONMANY] " & _
                "WHERE [COUNTRY]='" & rstInputFile![COUNTRY] & "' " & _
                "AND [TYPE]='" & rstInputFile![Type] & "' " & _
                "AND [BUSINESS UNIT]='" & rstInputFile![BUSINESS UNIT] & "' " & _
                "AND [L/R/G]='" & rstInputFile![L/R/G] & "' " & _
                "AND [REGION]='" & rstInputFile![REGION] & "' " & _
                "AND [JOB FUNCTION]='" & rstInputFile![JOB FUNCTION] & "'"
            MsgBox (strSQLHyperionMany)
            rstHyperionMany.Requery
            'If rstInputFile![COUNTRY].RecordCount = 1 Then
                rstInputFile![NUMINDEX] = rstHyperionMany![NUMFOREIGNKEY]  /// HERE IS THE ERROR LINE WHERE I CANNOT ASSIGN VALUES
            'Else
                'MsgBox ("Record not found")
            'End If
        End With
        rstInputFile.MoveNext
    Loop
End Sub

AnswerRe: Current record does not support updating... Pin
pmarfleet3-Oct-07 11:54
pmarfleet3-Oct-07 11:54 
QuestionRegarding date function in sql Pin
gupthakrishna3-Oct-07 10:46
gupthakrishna3-Oct-07 10:46 
AnswerRe: Regarding date function in sql Pin
pmarfleet3-Oct-07 11:33
pmarfleet3-Oct-07 11:33 
QuestionInstall sql database using custome actions Pin
Polymorpher3-Oct-07 8:03
Polymorpher3-Oct-07 8:03 
Questionnewbie ID question.. Pin
Dio223-Oct-07 3:47
Dio223-Oct-07 3:47 
AnswerRe: newbie ID question.. Pin
Colin Angus Mackay3-Oct-07 3:51
Colin Angus Mackay3-Oct-07 3:51 
AnswerRe: newbie ID question.. Pin
Michael Potter3-Oct-07 3:58
Michael Potter3-Oct-07 3:58 
AnswerRe: newbie ID question.. Pin
Dio223-Oct-07 4:08
Dio223-Oct-07 4:08 
QuestionSet Password Pin
mehrdadc483-Oct-07 2:58
mehrdadc483-Oct-07 2:58 
AnswerRe: Set Password Pin
Michael Potter3-Oct-07 3:47
Michael Potter3-Oct-07 3:47 
QuestionSQL Reporting Services Pin
arnoldpinto843-Oct-07 2:20
arnoldpinto843-Oct-07 2:20 
Questionreturn identity.. [modified] Pin
Dio223-Oct-07 2:13
Dio223-Oct-07 2:13 
AnswerRe: return identity.. Pin
N a v a n e e t h3-Oct-07 3:21
N a v a n e e t h3-Oct-07 3:21 
GeneralRe: return identity.. Pin
Dio223-Oct-07 3:35
Dio223-Oct-07 3:35 
QuestionAny way to retrieve the creation date of a row in a SQL Table Pin
Anurag Gandhi3-Oct-07 0:05
professionalAnurag Gandhi3-Oct-07 0:05 
AnswerRe: Any way to retrieve the creation date of a row in a SQL Table Pin
Pete O'Hanlon3-Oct-07 0:24
mvePete O'Hanlon3-Oct-07 0:24 
QuestionOnline Exam Application Pin
Sunitha Sudheesh3-Oct-07 0:04
Sunitha Sudheesh3-Oct-07 0:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.