Shawn
asked on
update query - trouble with recordset
In the query below I am getting the error "method or data member not found" for rs.NegociatedRate.
What am I doing wrong?
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, got it.
I'm a little confused as to when to use . and when to use !
I'm a little confused as to when to use . and when to use !
ASKER
both answers are right. First right answer or split?
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.
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.
ASKER
great, thanks for clarification.
If you want to tackle another question, I've been stuck on this one for a while
https://www.experts-exchange.com/questions/28017619/update-query-problem-with-sql-server-be.html
Shawn
If you want to tackle another question, I've been stuck on this one for a while
https://www.experts-exchange.com/questions/28017619/update-query-problem-with-sql-server-be.html
Shawn
Rs!fieldname