473,574 Members | 3,101 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error: M$ jet database engine does not recognize 'AA0023' as a valid field name

31 New Member
I am using M.S.Access as backend database and able to add records from Excel but not able to Edit & Update the specific record from M.s Access with reference to cell value given in excel. Kinldy help me.

Regards,
ANANTH
Sep 2 '07 #1
11 3048
puppydogbuddy
1,923 Recognized Expert Top Contributor
I am using M.S.Access as backend database and able to add records from Excel but not able to Edit & Update the specific record from M.s Access with reference to cell value given in excel. Kinldy help me.

Regards,
ANANTH
If your table and workbook are linked, see the following KB article from microsoft:

http://support.microsoft.com/kb/904953
Sep 2 '07 #2
Tempalli
31 New Member
Kindly help me on this code. I am not able to work on this.

Sub EDIT_UPATE()
Dim Path As String
Dim rs As DAO.Recordset
Dim AccountId As String

Path = "C:\Documen ts and Settings\Jaganm ohan\Desktop\db 1.mdb"
Set Db = Workspaces(0).O penDatabase(Pat h, ReadOnly:=True)
Set rs = Db.OpenRecordse t("Accounts")

rs.FindFirst "AccountId = 2235" ' DAO only

If Not rs.NoMatch Then

rs.Edit ' DAO only
rs!Amount = 200
rs.Update
Else
MsgBox "Record Not Found"
End If

End Sub
Sep 3 '07 #3
puppydogbuddy
1,923 Recognized Expert Top Contributor
Kindly help me on this code. I am not able to work on this.

Sub EDIT_UPATE()
Dim Path As String
Dim rs As DAO.Recordset
Dim AccountId As String

Path = "C:\Documen ts and Settings\Jaganm ohan\Desktop\db 1.mdb"
Set Db = Workspaces(0).O penDatabase(Pat h, ReadOnly:=True)
Set rs = Db.OpenRecordse t("Accounts")

rs.FindFirst "AccountId = 2235" ' DAO only

If Not rs.NoMatch Then

rs.Edit ' DAO only
rs!Amount = 200
rs.Update
Else
MsgBox "Record Not Found"
End If

End Sub
I am not sure what this has to do with your original question, but see below:
Expand|Select|Wrap|Line Numbers
  1. Sub EDIT_UPATE()
  2. Dim Path As String
  3. Dim rs As DAO.Recordset
  4. Dim AccountId As String
  5.  
  6. Path = "C:\Documents and Settings\Jaganmohan\Desktop\db1.mdb"
  7. Set Db = Workspaces(0).OpenDatabase(Path, ReadOnly:=False)
  8. Set rs = Db.OpenRecordset("Accounts", DbOpenDynaset)
  9.  
  10.  
  11. If rs.RecordCount <> 0 Then
  12.               rs.FindFirst "AccountId = 2235" ' DAO only
  13.               If Not rs.NoMatch Then
  14.                   rs.Edit ' DAO only
  15.                   rs!Amount = 200
  16.                   rs.Update
  17.              Else
  18.                   MsgBox "Record Not Found"
  19.              End IfEnd If
  20. rs.Close
  21. Set Db = Nothing
  22. Set rs = Nothing
  23.  
  24. EndSub
Sep 3 '07 #4
Tempalli
31 New Member
Thanks for your help in this regards, it is working fine.

I am having a AccountNo in Sheets("Sheet1" ).Range("A1") for "AccountID" ,
How can i define in this code to edit and update the record.

Kindly help me if it is possible.

(Ex.rs.FindFirs t "AccountId = "????" )

Regards,
Ananth


I am not sure what this has to do with your original question, but see below:
Expand|Select|Wrap|Line Numbers
  1. Sub EDIT_UPATE()
  2. Dim Path As String
  3. Dim rs As DAO.Recordset
  4. Dim AccountId As String
  5.  
  6. Path = "C:\Documents and Settings\Jaganmohan\Desktop\db1.mdb"
  7. Set Db = Workspaces(0).OpenDatabase(Path, ReadOnly:=False)
  8. Set rs = Db.OpenRecordset("Accounts", DbOpenDynaset)
  9.  
  10.  
  11. If rs.RecordCount <> 0 Then
  12.               rs.FindFirst "AccountId = 2235" ' DAO only
  13.               If Not rs.NoMatch Then
  14.                   rs.Edit ' DAO only
  15.                   rs!Amount = 200
  16.                   rs.Update
  17.              Else
  18.                   MsgBox "Record Not Found"
  19.              End If
End If
  • rs.Close
  • Set Db = Nothing
  • Set rs = Nothing
  •  
  • EndSub
  • Sep 4 '07 #5
    puppydogbuddy
    1,923 Recognized Expert Top Contributor
    There was a lot more to be done to give youwhat you are looking for. see below:
    Expand|Select|Wrap|Line Numbers
    1. Sub EDIT_UPATE()
    2. Dim xl As Object
    3. Dim xlSht As Object
    4. Dim xlWrkBk As Object
    5. Dim xlFilePath As String
    6. Dim xlFile As String
    7.  
    8. Dim dbFilePath As String
    9. Dim rs As DAO.Recordset
    10. Dim AccountId As String
    11. Dim Amount As Currency
    12.  
    13. XlFile = “ xxxx.xls”
    14. xlFilePath =  “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
    15. dbFilePath = "C:\Documents and Settings\Jaganmohan\Desktop\db1.mdb"
    16.  
    17. ‘open excel worksheet object
    18. Set xl = CreateObject("Excel.Application")
    19. Set xlWrkBk = GetObject(xlFile)
    20. Set xlSht = xlWrkBk.Worksheets(1)
    21.  
    22. ‘open access db table object
    23. Set Db = Workspaces(0).OpenDatabase(dbFilePath, ReadOnly:=False)
    24. Set rs = Db.OpenRecordset("Accounts", DbOpenDynaset)
    25.  
    26. ‘loop until no more cells to copy to table 
    27. If rs.RecordCount <> 0 Then
       rs.MoveFirst
    28.        Do Until. rs.EOF = True
    29.        rs.AddNew
    30.             rs.Fields("AccountId") = xlSht.cells(2, "F")
    31.             rs.Fields("Amount") = Nz(xlsSht.cells(2, "C"),0)         
    32.       rs.Update
    33.       rs.MoveNext     Loop
    34. End If
    35.  
    36. 'Closing excel
    37.  xlWrkBk.Application.Quit
    38. Set xl = Nothing
    39.  
    40. 'test db table by itself
    41.  rs.FindFirst "AccountId = 2235" ' DAO only
    42.               If Not rs.NoMatch Then
    43.                   rs.Edit ' DAO only
    44.                   rs!Amount = 200
    45.                   rs.Update
    46.              Else
    47.                   MsgBox "Record Not Found"
    48.              End If
    49. End If
    50.  
    51. 'Closing recordset
    52. rs.Close
    53. Set Db = Nothing
    54. Set rs = Nothing
    55.  
    56. End Sub
    Sep 4 '07 #6
    Tempalli
    31 New Member
    Kindly help me on this code where the error message shows as below.

    The Microsoft jet database engine does not recognize 'AA0023' as a valid field name of expression

    Regards,
    Ananth

    Field Name DataType
    --------------------------------------------------
    AccountID Text
    LOCATION Text

    --------------------------------------------------------------
    Account ID = AA0023
    LOCATION = INDIA
    ----------------------------------------------------------

    Private Sub File_No_AfterUp date()
    Dim Path As String
    Dim rs As DAO.Recordset
    Dim AccountId As String

    Path = "C:\db1.mdb "
    Set DB = Workspaces(0).O penDatabase(Pat h, ReadOnly:=False )
    Set rs = DB.OpenRecordse t("Accounts", dbOpenDynaset)

    If rs.RecordCount <> 0 Then
    rs.FindFirst "AccountId = " & Me.File_No
    If Not rs.NoMatch Then
    rs.Edit ' DAO only
    Me.Location = rs!Location
    Else
    MsgBox "Record Not Found"
    End If
    End If
    rs.Close
    Set DB = Nothing
    Set rs = Nothing
    End Sub
    Oct 31 '07 #7
    Tempalli
    31 New Member
    Kinldy help me on this code where i am receiving a error message as
    --------- The Microsoft jet database engine does not recognize 'AA0023' as a valid field name of expression --------

    Field Name DataType
    AccountID Text
    LOCATION Text

    Account ID = AA0023
    LOCATION = INDIA


    Private Sub File_No_AfterUp date()
    Dim Path As String
    Dim rs As DAO.Recordset
    Dim AccountId As String

    Path = "C:\db1.mdb "
    Set DB = Workspaces(0).O penDatabase(Pat h, ReadOnly:=False )
    Set rs = DB.OpenRecordse t("Accounts", dbOpenDynaset)

    If rs.RecordCount <> 0 Then
    rs.FindFirst "AccountId = " & Me.File_No ' DAO only
    If Not rs.NoMatch Then
    rs.Edit ' DAO only
    Me.Location = rs!Location
    Else
    MsgBox "Record Not Found"
    End If
    End If
    rs.Close
    Set DB = Nothing
    Set rs = Nothing
    End Sub
    Oct 31 '07 #8
    FishVal
    2,653 Recognized Expert Specialist
    Hi, there.

    String constants should be enclosed with single quotes.
    rs.FindFirst "AccountId = '" & Me.File_No & "'"
    Oct 31 '07 #9
    MMcCarthy
    14,534 Recognized Expert Moderator MVP
    I have merged both posts into one. Please do not double post your question as it causes confusion among the experts when trying to answer your query.

    ADMIN
    Oct 31 '07 #10

    Sign in to post your reply or Sign up for a free account.

    Similar topics

    1
    5021
    by: Wayno | last post by:
    My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I double-checked the path to my error log. It is in /var/www/logs/php_error_log Thanks. :) -Wayne Stevenson
    3
    6676
    by: g_mx6 | last post by:
    I am not sure what I am doing wrong. I am trying to open a DSNLess connection and retrieve the data in an Excel sheet using ASP. Shouldnt be this complicated but I've been trying to get this to work. I have a named range called Sheet1. Please assist me in this. Below is the CODE and ERROR. <% '************CODE Dim oConn, oRs
    11
    1934
    by: andre | last post by:
    Hi, Maybe not the right newsgroup, but it's an ASP problem, so .. This ASP file works fine with VBscript: <% set objdc = Server.CreateObject("ADODB.Connection") objdc.Open("provider=msdasql; driver={microsoft access driver (*.mdb)}; dbq=d:\access\newres.mdb") sql="select dag, aantalu from daguur;"
    0
    23463
    by: HKSHK | last post by:
    This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub) 5: Procedure call or argument is not valid. 6: Overflow. 7: Out of memory.
    9
    9675
    by: Ecohouse | last post by:
    I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
    2
    2046
    by: darkhat01 | last post by:
    I am running a cross tab on a Union query and I am getting and error. The Microsoft Jet database engine does not recognize '!!' as a valid field name or expression. Here is the SQl code: TRANSFORM Count(.IDCount) AS Expr1 SELECT . AS Expr2, Count(.IDCount) AS FROM WHERE (((.Database)<>"ASOF")) GROUP BY .
    6
    4463
    by: ramab | last post by:
    Hi friends, Im getting an error when running my report which is related to a crosstab.my crosstab query will display null but when i run the report some of the fields are blanks. e.g In my cross tab query: Completed: 2 InProgress: 3 Pending: But when i run the report it does not recognize the field pending and give the error i mentioned...
    0
    1626
    by: carl_birchall | last post by:
    I would really appreciate a nudge in the right direction on how to resolve this issue, as despite checking previous listings still not getting anywhere. I have 4 tables tblApplicant_Person App_Person_ID PK
    2
    1710
    by: darkhat01 | last post by:
    I am getting an error when I try and attach a cross tab query to the following query: SELECT .IDCount, ., ., .Database, ., .OTS, ., .PCI, ., .Cabinet, ., ., ., .Owner, ., ., . FROM WHERE (((.Database)<>"CM Open Risk") AND ((.)<)) ORDER BY . DESC; I know that it has something to do with using < in the query. The error I am getting is "The...
    0
    7805
    marktang
    by: marktang | last post by:
    ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
    0
    8234
    jinu1996
    by: jinu1996 | last post by:
    In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
    0
    8098
    tracyyun
    by: tracyyun | last post by:
    Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
    0
    6452
    agi2029
    by: agi2029 | last post by:
    Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
    1
    5620
    isladogs
    by: isladogs | last post by:
    The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
    0
    5300
    by: conductexam | last post by:
    I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
    0
    3740
    by: TSSRALBI | last post by:
    Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
    1
    2243
    by: 6302768590 | last post by:
    Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
    0
    1060
    bsmnconsultancy
    by: bsmnconsultancy | last post by:
    In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

    By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

    To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.