View Full Version : Please Help!!!!


callykid65
04-28-2006, 09:50 AM
I'm trying to update a table based on a field in an unbound form

Here’s the code:
Private Sub Command38_Click()
Dim strPartNo As String
strPartNo = Me!fldPartNumber
Set dbs = CurrentDb()
Set rstBalUD = dbs.OpenRecordset("SELECT * from PartsInventory WHERE CO_PART_NO = [fldPartNumber]", 1)
rsBalud!SERVBAL = Me!fldNewServBal
rstBalUD.UPDATE

End Sub



Here’s the error:
Run-time error ‘3011’
The Mircosoft jet database engine could not find the object ‘SELECT *
from Partsinventory WHERE CO_PART_NO = [fldPartNumber]’.
Make sure the object exists and that you spell its name and path name
correctly.

Smart
05-30-2006, 06:33 AM
Try something like this

Dim strStoreSQL As String
strStoreSQL = ("SELECT * from PartsInventory WHERE PartsInventory.CO_PART_NO = " & [fldPartNumber].Value

Set daoRst = daoDbs.OpenRecordset(strStoreSQL)

ideefixe
05-31-2006, 05:42 AM
You already have a variable strPartNo which holds this value. Use

CDbl(strPartNo) instead of the [fldPartNumber] which it won't recognise as a value.