473,386 Members | 1,745 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,386 software developers and data experts.

3251 Run Time Error with FindFirst

I'm trying to use the FindFirst method when loading a form (ServiceRecordF) to decide if I need to use this form OR open a different form (ServiceRecordNewF) and close this form.

Expand|Select|Wrap|Line Numbers
  1.     Dim IntArgs
  2.     Dim dbsEquipmentAndServiceHistory As Database
  3.     Dim rstUnitNumSortCriteria As Recordset
  4.     Dim rstServiceRecord As Recordset
  5.  
  6.     IntArgs = OpenArgs
  7.  
  8.     Set dbsEquipmentAndServiceHistory = CurrentDb
  9.     Set rstUnitNumSortCriteria = dbsEquipmentAndServiceHistory.OpenRecordset("UnitNumSortCriteriaT")
  10.  
  11.     With rstUnitNumSortCriteria
  12.     .Edit
  13.  
  14.     !UnitNumSortValue = IntArgs
  15.  
  16.     .Update
  17.     .Close
  18.     End With
  19.  
  20.     Set dbsEquipmentAndServiceHistory = CurrentDb
  21.     Set rstServiceRecord = dbsEquipmentAndServiceHistory.OpenRecordset("ServiceRecordT")
  22.  
  23.     With rstServiceRecord
  24.     rstServiceRecord.FindFirst "[UnitNum] =" & "'" & IntArgs & "'"
  25.  
  26.     If rstServiceRecord.NoMatch Then
  27.  
  28.         DoCmd.OpenForm "ServiceRecordNewF", acNormal, , , acFormAdd, , IntArgs
  29.         DoCmb.Close "ServiceRecordF"
  30.  
  31.     End If
  32.     .Close
  33.     End With
  34.     dbsEquipmentAndServiceHistory.Close
  35.  
When I open this form, the code stops at : rstServiceRecord.FindFirst "[UnitNum] =" & "'" & IntArgs & "'"

I receive the following message box message "Run time error '3251' Operation is not supported for this type of object"

The little debug functionality shows that I've passed my OpenArgs value successfully. I just don't see what's wrong with any of the objects in the line. Sorry to show the whole sub, just don't know enough to assume.
Sep 17 '13 #1
3 1392
MikeTheBike
639 Expert 512MB
Hi

At first glance the only thing I could see is that if [UnitNum] is a numeric field (hinted at by IntArge) then this
Expand|Select|Wrap|Line Numbers
  1. rstServiceRecord.FindFirst "[UnitNum] =" & "'" & IntArgs & "'"
should be this
Expand|Select|Wrap|Line Numbers
  1. rstServiceRecord.FindFirst "[UnitNum] =" & IntArgs
??

MTB
Sep 18 '13 #2
UnitNum is text, although I happen to be passing numbers. I try to do my homework before seeking out guidance. I'm terribly appreciative of whatever help is provided. I just can't make sense of this. Am I perhaps using the DAO methods incorrectly above?

Again, I have two forms (one for creating records one for editing records) I want to utilize, but the decision on which to go to is based on whether an existing record is out there.

You can also see above where I'm updating a record with OpenArgs information so I can SQL with the term. That part works, but I don't want to assume it doesn't cause problems below.
Sep 18 '13 #3
I think I figured it out. Looks like I needed to set the parameter dbOpenDynaset to get past the object problem.

Set rstServiceRecord = dbsEquipmentAndServiceHistory.OpenRecordset("Servi ceRecordT", dbOpenDynaset)
Sep 18 '13 #4

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

Similar topics

0
by: Miranda Evans | last post by:
I noticed several postings about issues related to "run-time error 3061", and I observed that the solutions to these issues appear to involve correcting something within the SQL code. I'm...
2
by: dailem | last post by:
I have a bit of code tied to a command button in Access that runs a query then transfers it to a new Excel worksheet (& new file). It works fine EVERY OTHER TIME THAT I RUN IT....what the 'heck...
4
by: Christaaay | last post by:
I have been using the code below successfully for almost a year. yesterday, I began getting a run time error 6 (overflow). I am using the code in an Access 2000 database. Can anyone help me...
1
by: rclausen | last post by:
Moved a working MS Access application from Win2000 (version 5.0 SP 3) OS with MS Access 2000 and DB2 Run-time client v7.1 FP 4 to XP (version 5.1, SP 2) OS with MS Access 2003 and DB2 Run-time...
9
by: ThunderMusic | last post by:
Hi, I'd like to create a compile time error in my class... maybe there's a way already built in in the framework so I can achieve what I want... I have 2 constructors in my class. One of them...
0
by: CliffPrince | last post by:
I am getting a C++ run time error when running crystal reports through a report viewer. The problem does not occur when running the reports in crystal reports. It is not consistent. The same...
10
richardhodge
by: richardhodge | last post by:
I am a VB6 database programmer and have run into a small problem. The company I work for primarily uses Microsoft Access 2000 for the database that is the back end for our software. Well the...
3
by: DontB3 | last post by:
Hi, I'm new in this forum, and i hope someone can help. I'm creating an automatic application that transfer a database from Access -> DBF -> Oracle. When My App try to execute Insert SQL...
1
by: dee | last post by:
I have a form 'FmMessages" and a form 'FmLeads'. 'FmMessages', through code, opens 'FmMessages" if it is not already open. It then sets focus on 'FmLeads' and runs the following code: Dim rst...
7
by: hpesoj | last post by:
When i copy data form to multiple form i get a "Run-time error 3021. No current record " in the line "rst2.MoveLast"...Can you help me out... Private Sub Process_AfterUpdate() Dim db As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.