Solved

update query - trouble with recordset

Posted on 2013-02-04
7
239 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
  • 3
  • 3
7 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 250 total points
Comment Utility
Check your spelling and use ! Instead of .  For fieldnames.
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 250 total points
Comment Utility
rs!NegociatedRate

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

Expert Comment

by:mbizup
Comment Utility
Same applies for all of your fieldnames...

Rs!fieldname
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 1

Author Comment

by:Shawn
Comment Utility
ok, got it.

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

Author Comment

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

Expert Comment

by:mbizup
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now