Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting .mdb code to .adp code

Status
Not open for further replies.

ind

Programmer
Mar 9, 2000
121
US
I need help!!!!!!!!!!! I keep getting the following error when I upsize my .mdb file to an .adp file:<br>
<br>
Object Variable or With block variable not set<br>
<br>
Everytime I try to run my form I get the error on the following line of code:<br>
<br>
Set GetData = CurDB.OpenRecordSet (&quot;SELECT 8* From TableName&quot;, DB_OPEN_DYNASET<br>
<br>
Any suggestions on how to fix this would be GREATLY appreciated.<br>
<br>
<br>
Thanks,<br>
ind
 
Well this is a mixture of who knows what.<br>
I use this<br>
------------------------------------------<br>
Dim db as database, rst as recordset, SQL as string<br>
Set db = CurrentDb<br>
' SQL string.<br>
SQL = &quot;SELECT * FROM Orders WHERE OrderDate &gt;= #1-1-95#;&quot;<br>
Set rst = db.OpenRecordset(SQL)<br>
------------------------------------------<br>
<br>
Also have a look at &quot;SQL&quot; in help <p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
I tried your suggestion but still no luck.<br>
Maybe the entire line of code would help.<br>
Thanks again.<br>
<br>
<br>
<br>
Public Function RefreshSmartSearch()<br>
Dim CurDB As Database, GetData As Recordset, RestofArgs As String<br>
Set CurDB = CurrentDb()<br>
Me!OptionLabel1.Visible = False<br>
Me.Option1.Visible = False<br>
Me!OptionLabel2.Visible = False<br>
Me.Option2.Visible = False<br>
Me!OptionLabel3.Visible = False<br>
Me.Option3.Visible = False<br>
Me!OptionLabel4.Visible = False<br>
Me.Option4.Visible = False<br>
Me!OptionLabel5.Visible = False<br>
Me.Option5.Visible = False<br>
Me!OptionLabel6.Visible = False<br>
Me.Option6.Visible = False<br>
Me!OptionLabel7.Visible = False<br>
Me.Option7.Visible = False<br>
Me!OptionLabel8.Visible = False<br>
Me.Option8.Visible = False<br>
If Not IsNull(Me.OpenArgs) Then<br>
'This code parses the OpenArgs line stripping the Entry Name, Key Field Name, Key Field Type of Data, and Calling Form<br>
'Each variable is separated by commas. Using the Left and Mid functions it finds the commas and therefore the data<br>
'RestofArgs is a temporary variable used to store the Rest of the Argument String<br>
'DefEntry, KeyField, KeyDataType, and CallingForm are Declared in this form<br>
'They are used to return to the calling form<br>
Me!SmartSearchTabs.Pages![Define Search].Visible = False<br>
Me!SmartSearchTabs.Pages![Display All].Visible = False<br>
Me!SmartSearchTabs.Style = 2<br>
<br>
DefEntry = Left(Me.OpenArgs, InStr(1, Me.OpenArgs, &quot;,&quot;) - 1)<br>
RestofArgs = Mid(Me.OpenArgs, InStr(1, Me.OpenArgs, &quot;,&quot;) + 1)<br>
KeyField = Left(RestofArgs, InStr(1, RestofArgs, &quot;,&quot;) - 1)<br>
RestofArgs = Mid(RestofArgs, InStr(1, RestofArgs, &quot;,&quot;) + 1)<br>
KeyDataType = Left(RestofArgs, InStr(1, RestofArgs, &quot;,&quot;) - 1)<br>
CallingForm = Mid(RestofArgs, InStr(1, RestofArgs, &quot;,&quot;) + 1)<br>
<br>
Set GetData = CurDB.OpenRecordset(&quot;SELECT * FROM ezs_SmartSearchDefinition WHERE SearchID = &quot; & Chr(34) & DefEntry & Chr(34) & &quot; ORDER BY Sequence&quot;, DB_OPEN_DYNASET)<br>
Num = 1<br>
Me.caption = &quot;Smart Search-&quot; & DefEntry<br>
If GetData.EOF Then<br>
DoCmd.Close 'No Records Found - Close the Form<br>
Exit Function<br>
End If<br>
<br>
Else 'Definition Mode - No Arguments Passed<br>
Me!SmartSearchTabs.Pages![Define Search].Visible = True<br>
Me!SmartSearchTabs.Pages![Display All].Visible = True<br>
Me!SmartSearchTabs.Style = 0<br>
Me.SmartSearchTabs.TabFixedHeight = 0<br>
If Not IsNull(Me![FindSearchID]) Then<br>
DefEntry = Me![FindSearchID]<br>
Else<br>
Set GetData = CurDB.OpenRecordset(&quot;SELECT * FROM ezs_SmartSearchDefinition&quot;, DB_OPEN_DYNASET)<br>
If Not GetData.EOF Then<br>
DefEntry = GetData!SearchID<br>
End If<br>
End If<br>
Set GetData = CurDB.OpenRecordset(&quot;SELECT * FROM ezs_SmartSearchDefinition WHERE SearchID = &quot; & Chr(34) & DefEntry & Chr(34) & &quot; ORDER BY Sequence&quot;, DB_OPEN_DYNASET)<br>
Num = 1<br>
Me.caption = &quot;Smart Search Definition Mode-&quot; & DefEntry<br>
End If<br>
<br>
If Not GetData.EOF Then<br>
GetData.MoveLast<br>
NumSearch = GetData.RecordCount<br>
GetData.MoveFirst<br>
Do While Not GetData.EOF<br>
Me!FindSearchID = GetData!SearchID<br>
Select Case Num<br>
Case 1<br>
Me!OptionLabel1 = GetData!OptionLabel<br>
Me!OptionLabel1.Visible = True<br>
Me.Option1.Visible = True<br>
If GetData!LastSelectedOption &gt;= 1 And GetData!LastSelectedOption &lt;= 8 Then<br>
Me![TypeofSearch] = GetData!LastSelectedOption<br>
Else<br>
Me![TypeofSearch] = 1<br>
End If<br>
Case 2<br>
Me!OptionLabel2 = GetData!OptionLabel<br>
Me!OptionLabel2.Visible = True<br>
Me.Option2.Visible = True<br>
Case 3<br>
Me!OptionLabel3 = GetData!OptionLabel<br>
Me!OptionLabel3.Visible = True<br>
Me.Option3.Visible = True<br>
Case 4<br>
Me!OptionLabel4 = GetData!OptionLabel<br>
Me!OptionLabel4.Visible = True<br>
Me.Option4.Visible = True<br>
Case 5<br>
Me!OptionLabel5 = GetData!OptionLabel<br>
Me!OptionLabel5.Visible = True<br>
Me.Option5.Visible = True<br>
Case 6<br>
Me!OptionLabel6 = GetData!OptionLabel<br>
Me!OptionLabel6.Visible = True<br>
Me.Option6.Visible = True<br>
Case 7<br>
Me!OptionLabel7 = GetData!OptionLabel<br>
Me!OptionLabel7.Visible = True<br>
Me.Option7.Visible = True<br>
Case 8<br>
Me!OptionLabel8 = GetData!OptionLabel<br>
Me!OptionLabel8.Visible = True<br>
Me.Option8.Visible = True<br>
End Select<br>
GetData.MoveNext<br>
Num = Num + 1<br>
Loop<br>
End If<br>
TypeofSearch_AfterUpdate<br>
End Function<br>
<br>
<br>
<br>

 
Although this post is old, maybe this info might help others:
By default, .ADP's use ADO. Either change your code to use ADO or set your references to use DAO.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top