SyncCriteria = BuildCriteria problem

J

jayglass

Greetings everyone!!

I am trying to sync to forms. Basically, on one form which looks lik
an excel spreadsheet, if the user double clicks the DHS number, it i
supposed to open another form synced to that DHS number. The problem i
my code keeps giving me an error that I don't understand... Below i
the code:

The problem is with the line SyncCriteria = BuildCriteria("DHS"
dbtext, Me![DHS]). It keeps telling me that dbtext is a variable no
defined.

Private Sub DHS_DblClick(Cancel As Integer)
If IsNull(Me![DHS]) Then
Exit Sub
End If

DoCmd.OpenForm ("frm_individual_case")

''Define variables.
Dim FormName As String, SyncCriteria As String
Dim F As Form, RS As Recordset

''Set the formname to "frm_individual_case," the form that will b
synchronized.
FormName = "frm_individual_case"


''Check to see if the individual case form is open. If it is no
open, open it.
If Not SysCmd(acSysCmdGetObjectState, acForm, FormName) Then
DoCmd.OpenForm FormName
End If

''Define the form object and Recordset object for the Product
form.
Set F = Forms(FormName)
Set RS = F.RecordsetClone

''Define the criteria used for the synchronization.
SyncCriteria = BuildCriteria("DHS", dbtext, Me![DHS])


'Synchronize the corresponding record in the Children form to th
current record in the subform.
RS.FindFirst SyncCriteria

''If a record exists in the Products form, find the matchin
record.
If RS.NoMatch Then
MsgBox "No match exists!", 64, FormName
Else
F.Bookmark = RS.Bookmark
End If

End Sub

Any help you can offer would be much appreciated...

SyncCriteria = BuildCriteria("DHS", dbtext, Me![DHS]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top