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

Highlight a line in a continuous form (& FindFirst)

I am trying to get a continuous form to highlight lines individually (ideally on hover). I have used the following code as recommended by a previous entry on this website. My problems begin in that my Database does not appear to recognise "FindFirst". The sample database I downloaded for help does recognise the script and when I begin to type the drop down gives the prompt for "FindFirst"! Why is it that my MDB does not? The only drop downprompt is "Find"

The code I am trying to work with is:
Expand|Select|Wrap|Line Numbers
  1. Function GetLineNumber()
  2. Dim RS As Recordset
  3. Dim CountLines
  4. Dim F As Form
  5. Dim KeyName As String
  6. Dim KeyValue
  7.  
  8. Set F = Form
  9. KeyName = "productid"
  10. KeyValue = [ProductID]
  11.  
  12.          On Error GoTo Err_GetLineNumber
  13.          Set RS = F.RecordsetClone
  14.          ' Find the current record.
  15.          Select Case RS.Fields(KeyName).Type
  16.             ' Find using numeric data type key value.
  17.             Case DB_INTEGER, DB_LONG, DB_CURRENCY, DB_SINGLE, _
  18.             DB_DOUBLE, DB_BYTE
  19.                RS.FindFirst "[" & KeyName & "] = " & KeyValue
  20.             ' Find using date data type key value.
  21.             Case DB_DATE
  22.                RS.FindFirst "[" & KeyName & "] = #" & KeyValue & "#"
  23.             ' Find using text data type key value.
  24.             Case DB_TEXT
  25.                RS.FindFirst "[" & KeyName & "] = '" & KeyValue & "'"
  26.                RS.F
  27.             Case Else
  28.             MsgBox "ERROR: Invalid key field data type!"
  29.                Exit Function
  30.                End Select
  31.          ' Loop backward, counting the lines.
  32.          Do Until RS.BOF
  33.             CountLines = CountLines + 1
  34.             RS.MovePrevious
  35.             Loop
  36. Bye_GetLineNumber:               ' Return the result.
  37.          GetLineNumber = CountLines
  38.          Exit Function
  39. Err_GetLineNumber:
  40.       CountLines = 0
  41.       Resume Bye_GetLineNumber
  42. End Function
  43.  
Any assistance please.
Aug 8 '07 #1
3 3247
JKing
1,206 Expert 1GB
I suppose we should start with the FindFirst issue. Check to make sure you have a reference to the Microsoft DAO 3.6 Object Library (or higher). To do this open the VBA editor and go to Tools > References then scroll through to find and check the library.
Aug 8 '07 #2
I suppose we should start with the FindFirst issue. Check to make sure you have a reference to the Microsoft DAO 3.6 Object Library (or higher). To do this open the VBA editor and go to Tools > References then scroll through to find and check the library.

Have done as suggested and added MS DAO 3.6 as well as Utility.mda but still I can only get "Find" when I start typing and enter a period (.) ie rs. producing a drop down list but sadly no FindFirst only "Find". I am sure there is a simple solution. Your help and knowledge is appreciated!
Aug 9 '07 #3
Have done as suggested and added MS DAO 3.6 as well as Utility.mda but still I can only get "Find" when I start typing and enter a period (.) ie rs. producing a drop down list but sadly no FindFirst only "Find". I am sure there is a simple solution. Your help and knowledge is appreciated!
Have since tried the following which has worked!

Dim rs AS DAO.recordset

This has enabled the FindFirst in the drop down list.

Thanks for the pointer.

Any other ideas on highlighting an individual line in a continuous form ideally on "hover"?
Aug 10 '07 #4

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

Similar topics

3
by: Deano | last post by:
Here's a good one that keeps defeating me... I have a continuous form that has a date textbox as one of the controls. The user can choose any date they like including one they have already...
3
by: Prakash Wadhwani | last post by:
Is there any EASY way to highlight a full row in a continuous form so that as i navigate up & down the table/continuous form using the arrow keys, the entire line (all fields) get highlighted ? ...
2
by: Steve K | last post by:
Firstly, how the heck does this guy do it? Writing reams of (awesome) code, debugging, responding to Newsgroups etc., all while commanding the ridiculous price of FREE?!?!?! More power to him! ...
3
by: Typehigh | last post by:
I am a good programmer, but this one stumps me! I have a form with a continuous subform. The continuous subform contains records of data and may reach a depth of 1000's of entities. I have...
4
by: neoman007 | last post by:
I have a form (frm_approval) which is based on a query (qry_unapproved). The query queries a table (tbl_total) for records that are unapproved and shows these records in (frm_approval) so the...
3
by: eighthman11 | last post by:
Using Access 2000. I have a continuous form which for simplicity sack has two fields Social Security Number and Last Name. In the header of the continuous form I have a textbox where you can...
2
by: wassimdaccache | last post by:
Please help me Using access 2003 I do have a form (continuous) that expand for me all products in a table name " I made a in this form and it is unbounded What i need is a botton...
13
by: eighthman11 | last post by:
using Access 2003 and sql server version 8.0 Hey everyone. Created a text box where the user types in an Inventory number and it takes them to that inventory number on the contimuous form. The...
2
by: Steve | last post by:
I have a continuous form showing Product Code and Product Name. Product Code is five digits and is sequential. I have a textbox in the form header. What is the code to scroll the continuous form so...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.