473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Suddenly receiving Error #3270 - Property Not Found

39
Hi All,

I have been creating a database that basically searches for data based on the SQL string created. So far, I was successful until I received -- Error Number 3270 - Property Not Found -- when I click on the button to trigger the search.

I modified a database which I found on line for my purposes.

See code below. How do I resolve the error message? What object is VB referring to when it says "property not found"?
Expand|Select|Wrap|Line Numbers
  1.  Option Compare Database
  2. Option Explicit
  3. 'This database code has been modified  based on Martin Green's website
  4. '************************** Õ¿Õ- **************************
  5. '*** Coded by Martin Green ******* {Removed} ***
  6. '******* Office Tips Web Site - www.fontstuff.com *********
  7. '**********************************************************
  8.  
  9. ' This code uses ADO and ADOX and is suitable for Access 2000 (and later).
  10. ' A reference must be set to Microsoft ADO Ext. 2.7 for DDL and Security.
  11.  
  12. Public Sub cmdOK_Click()
  13.     On Error GoTo cmdOK_Click_Err
  14.     Dim blnQueryExists As Boolean
  15.     Dim cat As New ADOX.Catalog     'ADOX namespace declared to provide a class named Catalog
  16.     Dim cmd As New ADODB.Command
  17.     Dim qry As ADOX.View
  18.     Dim varItem As Variant
  19.     Dim strGrProgram As String
  20.     Dim strRegion As String
  21.     Dim strState As String
  22.     Dim strRegionCondition As String
  23.     Dim strStateCondition As String
  24.     Dim strSQL As String
  25.     Dim Msg, Style, Title, Response, MyString
  26.  
  27. ' You might want to use a make some sort of temporary table query to creat a table for the cross tabluation table
  28.     DoCmd.SetWarnings False
  29.     DoCmd.OpenQuery "qmak_Data_CROSS", acViewNormal, acEdit
  30.     DoCmd.SetWarnings True
  31.  
  32. ' Check for the existence of the stored query
  33.     blnQueryExists = False
  34.     Set cat.ActiveConnection = CurrentProject.Connection
  35.     For Each qry In cat.Views
  36.         If qry.Name = "qryALL_I2" Then
  37.             blnQueryExists = True
  38.             Exit For
  39.        End If
  40.     Next qry
  41. ' Create the query if it does not already exist
  42.     If blnQueryExists = False Then
  43.         cmd.CommandText = "SELECT * FROM tbNational9"
  44.         cat.Views.Append "qryALL_I2", cmd
  45.     End If
  46.     Application.RefreshDatabaseWindow
  47. ' Turn off screen updating
  48.     DoCmd.Echo False
  49. ' Close the query if it is already open
  50.     If SysCmd(acSysCmdGetObjectState, acQuery, "qryALL_I2") = acObjStateOpen Then
  51.         DoCmd.Close acQuery, "qryALL_I2"
  52.     End If
  53.  
  54. ' Build criteria string for Program
  55.     For Each varItem In Me.lstGrProgram.ItemsSelected
  56.         strGrProgram = strGrProgram & ",'" & Me.lstGrProgram.ItemData(varItem) & "'"
  57.     Next varItem
  58.  
  59.     If Len(strGrProgram) = 0 Then
  60.         strGrProgram = "Like '*'"
  61.  
  62.     Else
  63.         strGrProgram = Right(strGrProgram, Len(strGrProgram) - 1)
  64.         strGrProgram = "IN(" & strGrProgram & ")"
  65.     End If
  66.  
  67.      If strGrProgram = "Lap Band Program" Then
  68.         Msg = "Lap Band program information is unavailable in this I2 run. Please deselect."  'message defined
  69.         Style = vbInformation                                   'button defined
  70.         Title = "I2 Limitation Warning"                      'title defined
  71.         Response = MsgBox(Msg, Style, Title)
  72.     Else
  73.     End If
  74. ' Build criteria string for Region
  75.     For Each varItem In Me.lstRegion.ItemsSelected
  76.         strRegion = strRegion & ",'" & Me.lstRegion.ItemData(varItem) & "'"
  77.     Next varItem
  78.     If Len(strRegion) = 0 Then
  79.         strRegion = "Like '*'"
  80.     Else
  81.         strRegion = Right(strRegion, Len(strRegion) - 1)
  82.         strRegion = "IN(" & strRegion & ")"
  83.     End If
  84. ' Build criteria string for State
  85.     For Each varItem In Me.lstState.ItemsSelected
  86.         strState = strState & ",'" & Me.lstState.ItemData(varItem) & "'"
  87.     Next varItem
  88.     If Len(strState) = 0 Then
  89.         strState = "Like '*'"
  90.     Else
  91.         strState = Right(strState, Len(strState) - 1)
  92.         strState = "IN(" & strState & ")"
  93.     End If
  94. ' Get Region condition
  95.     If Me.optAndRegion.Value = True Then
  96.         strRegionCondition = " AND "
  97.     Else
  98.         strRegionCondition = " OR "
  99.     End If
  100. ' Get State condition
  101.     If Me.optAndState.Value = True Then
  102.         strStateCondition = " AND "
  103.     Else
  104.         strStateCondition = " OR "
  105.     End If
  106. ' Build SQL statement
  107.     strSQL = "SELECT tbNational9.* FROM tbNational9 " & _
  108.              "WHERE tbNational9.[GrProgram] " & strGrProgram & _
  109.              strRegionCondition & "tbNational9.[Region] " & strRegion & _
  110.              strStateCondition & "tbNational9.[StateReg] " & strState & ";"
  111.  
  112. ' Apply the SQL statement to the stored query
  113.     cat.ActiveConnection = CurrentProject.Connection
  114.     Set cmd = cat.Views("qryALL_I2").Command
  115.     cmd.CommandText = strSQL
  116.     Set cat.Views("qryALL_I2").Command = cmd
  117.     Set cat = Nothing
  118. ' Open the Query
  119.     DoCmd.OpenQuery "qryALL_I2", , acReadOnly
  120.  
  121. ' If required the dialog can be closed at this point
  122.  '    DoCmd.Close acForm, Me.Name
  123. ' Restore screen updating
  124.  
  125.     Application.RefreshDatabaseWindow
  126.  
  127.  
  128. cmdOK_Click_Exit:
  129.     DoCmd.Echo True
  130.     Exit Sub
  131. cmdOK_Click_Err:
  132.     MsgBox "An unexpected error hass occurred." _
  133.         & vbCrLf & "Procedure: cmdOK_Click" _
  134.         & vbCrLf & "Error Number: " & Err.Number _
  135.         & vbCrLf & "Error Description:" & Err.Description _
  136.         , vbCritical, "Error"
  137.     Resume cmdOK_Click_Exit
  138. End Sub
Aug 11 '11 #1
7 14138
Rabbit
12,516 Expert Mod 8TB
You didn't say which line the error is on.
Aug 11 '11 #2
Qtip23
39
Hi Rabbit,

I have the error trapping set to "Break on All Errors". Line 119 is highlighted.

Not quite sure why because the query exists.

Thx.
Aug 12 '11 #3
Rabbit
12,516 Expert Mod 8TB
I don't see anything explicitly wrong with it. When you hover over acReadOnly, does it show the number 2? Have you tried commenting everything else out to see if the issue really is with that line?
Aug 12 '11 #4
Mihail
759 512MB
Is your query working ? Try it outside VBA code.
I suspect that the query has a problem, not VBA code.
Aug 12 '11 #5
NeoPa
32,556 Expert Mod 16PB
At the point of the error (when line #119 is highlighted) try running that query manually (from the Database Window). If you get the same error then, you need to start looking more closely at the QueryDef itself.
Aug 12 '11 #6
NeoPa
32,556 Expert Mod 16PB
Qtip23:
I have the error trapping set to "Break on All Errors".
I missed this earlier. That's a setting to use only when checking code and in the stages of development where you, as a designer, want to see exactly where the code would break if you didn't handle them. This is not a good setting to use in the normal course of events (It can cause all sorts of confusions when running otherwise fine code). I suggest you set it to Break in class module instead, and leave it set that way unless/until you need it set differently for a specific, and temporary, reason.
Aug 12 '11 #7
Qtip23
39
It's working now. I followed some of everyone's tips.

@Rabbit - I did not see the number two when I hovered over. Perhaps this is because I turned off the Break on All Errors.

@Mihail @NeoPa - I ran the query in the database again. It worked like a charm.

I think perhaps the code was getting hung up since the query is based on a form control. The query does not display anything until the parameter (e.g. [forms]![frmABC]![cboEntry]) is selected.

Thanks!
Aug 12 '11 #8

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

Similar topics

0
by: Pai | last post by:
Hello there, every time I try to create a project using Visual Interdev 2003, I get the following error: The default web access mode for this project is set to file share, but the project...
0
by: Pai | last post by:
Hello there, every time I try to create a project using Visual Interdev 2003, I get the following error: The default web access mode for this project is set to file share, but the project...
0
by: Raphael Rodrigues | last post by:
Hi... I uninstalled my VS 2005 Express and when i try to reinstall them in my computer the TOOLBOX's content dissapear!!! I've tried "Choose Items" with right button in TOOLBOX panel but "Error...
0
by: Neal | last post by:
Hi I am trying to use a 3rd party DLL in my app, (WebService and/or WebApp) I set the references to it, use its public functions and properties OK in Dev mode but when I run it, i get the...
0
by: iyuen | last post by:
Have anyone seen this error? I'm trying to use a managed C++ class in an VB6 application. For each class definition in my header files (.h) I put in front of the defintion. Then I use regasm to...
0
by: | last post by:
Hello NG! I try to call a WebService from a mobile device. The WebService should return a DataSet, so the call looks like mDataSet = mWebSrv.GetDataSet(<Params>) but instead of returning a...
3
by: Java script Dude | last post by:
Has anybody hacked a stack parser for Mozilla Error stack property. Some basic regular expressions would work well, but my time is a little tight of late. Basically I would like to parse out,...
0
by: cider123 | last post by:
This is just information to maybe help others with the problem I ran across the other day. I had a Remote Object working just fine on a 2003 Server. I wanted to try it on another 2003 Server,...
1
by: ibaldwinjr | last post by:
Hi, I am trying to get a response from a URL using the HttpWebRequest object. this is my code below. httpRequest = (HttpWebRequest) WebRequest.Create(myurl); httpRequest.Method = "GET";...
0
by: Tony K | last post by:
ERROR MESSAGE RECEIVED WHEN SAVING. "The operation could not be completed. No such interface supported." Dell Inspirion E1705, 1GB RAM, Windows Vista Ultimate I can start debugging and the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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,...
0
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...

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.