RecordsetClone/FindFirst Query

GJT

Registered User.
Local time
Today, 17:17
Joined
Nov 5, 2002
Messages
116
Hi People!

I am using the following code to display the Find dialog :

Private Sub cmdInvoiceSearch_Click()
On Error GoTo Err_cmdInvoiceSearch_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
'
Exit_cmdInvoiceSearch_Click:

Exit Sub

Err_cmdInvoiceSearch_Click:
MsgBox err.Description
Resume Exit_cmdInvoiceSearch_Click
End Sub

________________________________

Am I right in assuming that if I use this dialog and then want to use the recordset object underlying my form (by way of RecordsetClone), that I need to move the recordset pointer using 'Findfirst' to locate the same record, as that reflected on my form????????

At the moment, when the form is refreshed with the record data, I get an 'Invalid Argument' runtime error 3001, when the FindFirst method is executed. If I manually close the MS Access Find dialog box, the line is executed without error??????

Any ideas......?????

NB. The reason I am using this approach is that I have a command button - whose state is either on/off depending on the boolean value in the appropriate field of the recordset. Just binding the button to the field in the table has no effect! Hence, the method described above.....


Guy
 
From the help files :

You can use the DoMenuItem action to carry out a Microsoft Access menu command.

Note In Microsoft Access 97, the DoMenuItem action has been replaced by the RunCommand action. The DoMenuItem action is included in this version of Microsoft Access only for compatibility with previous versions.

Here it is used to ivoke the menu commands for displaying the Find dialog.....
 
Oh I see your working with a version that became redundant in the last century:D
here's two alternatives
DoCmd.RunCommand acCmdFind

Dim rs As String
rs = Forms!Customers!CustomerID
DoCmd.RunCommand acCmdSaveRecord
Forms!Customers.Requery
Forms!Customers!Customers.SetFocus
DoCmd.FindRecord rs
 
Sorry Rich - but both of these do exactly what I already have in place...... i.e. they error with the same runtime 3001!
 
I have no problem with doing this although I use a function and just Call it, I suspect the problem is elsewhere, what is this boolean doing?
 
The boolean is a flag value representign whether a client is overseas......

DoCmd.RunCommand acCmdFind

This correctly finds the invoice record required (search on Invoice No. - unique ID), however the export flag as prev. mentioned is required to set the value of a command button.

If I bind the command button control source to this flag - nothing happens. So, I use the RecordsetClone object.
However the RecordsetClone record pointer does not mirror the current record as indicated on my form - hence I need to use RecordsetClone.FindFirst() to get the form data and the uncderlying Recrdset object(i.e. RecordsetClone) synchronised!

Once I have found said Invoice No. record - I can interrogate the RecordsetClone!Export flag value and set the appropriate value for the command Button!


Make sense????
 
Make sense????
not really
Why not use the Form_Current to determine the flag status?
 
Cheers ! That works - Im sure I did this though when I first built the dialog. After all - thats basic stuff!
 

Users who are viewing this thread

Back
Top Bottom