?
Solved

update query - trouble with recordset

Posted on 2013-02-04
7
Medium Priority
?
253 Views
Last Modified: 2013-02-04
In the query below I am getting the error "method or data member not found"  for rs.NegociatedRate.

What am I doing wrong?

    Dim db As DAO.Database
    Dim RcdSet As DAO.Recordset
    Dim sqlFP As String
    Set db = CurrentDb()
    sqlFP = "Select * From tblTranslationContractPurchases where trad_commandesID=" & Me![trad_commandesID]
    Set RcdSet = db.OpenRecordset(sqlFP, dbOpenDynaset, dbSeeChanges)
    
    Dim rs As DAO.Recordset
    Dim sqlOption As String
    sqlOption = "Select * From tbltrad_commandes_FPdetails where trad_commandesID=" & Me![trad_commandesID] & _
    "AND OptionSelected=1"
    Set rs = db.OpenRecordset(sqlOption, dbOpenDynaset, dbSeeChanges)
    
    
        If RcdSet.RecordCount = 0 Then
        'can't find proposal. need to do an append
        
        ElseIf RcdSet.RecordCount = 1 Then
            If rs.RecordCount = 0 Then
            MsgBox "You need to choose the number of words."
            ElseIf rs.RecordCount = 1 Then
            rs.MoveFirst
            DoCmd.SetWarnings False
            Dim strSQL As String
            strSQL = "Update tblTranslationContractPurchases set OrderDate = Now()," & _
here ====>>>            "NegociatedRate = " & rs.NegociatedRate & _
            ",ContractPrice = " & rs.ContractPrice & _
            ",ContractQuantity = " & rs.ContractQuantity & _
            ",FPEstimateStatus = 2 " & _
            "where tblTranslationContractPurchases.trad_commandesID = " & Me.trad_commandesID
            DoCmd.RunSQL strSQL
            DoCmd.SetWarnings True
            Else
            MsgBox "You need to choose the number of words. Only one option at a time."
            End If
        End If
    
    RcdSet.Close
    Set RcdSet = Nothing
    

Open in new window

0
Comment
Question by:Shawn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 1000 total points
ID: 38853102
Check your spelling and use ! Instead of .  For fieldnames.
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 1000 total points
ID: 38853111
rs!NegociatedRate

and the same for the other rs fields.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38853113
Same applies for all of your fieldnames...

Rs!fieldname
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 1

Author Comment

by:Shawn
ID: 38853136
ok, got it.

I'm a little confused as to when to use . and when to use !
0
 
LVL 1

Author Comment

by:Shawn
ID: 38853148
both answers are right. First right answer or split?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38853169
Use . for methods such as Update, MoveNext, etc and properties such as .NoMatch, etc.

Use ! for fieldnames, or the alternate syntax rs("FieldName")


>>> First right answer or split?

Our answers were almost at the same time.  A split is good with me.
0
 
LVL 1

Author Comment

by:Shawn
ID: 38853184
great, thanks for clarification.

If you want to tackle another question, I've been stuck on this one for a while
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_28017619.html

Shawn
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question