If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
SyncCriteria = BuildCriteria problem
Greetings everyone!! I am trying to sync to forms. Basically, on one form which looks like an excel spreadsheet, if the user double clicks the DHS number, it is supposed to open another form synced to that DHS number. The problem is my code keeps giving me an error that I don't understand... Below is the code: The problem is with the line SyncCriteria = BuildCriteria("DHS", dbtext, Me![DHS]). It keeps telling me that dbtext is a variable not 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 be synchronized. FormName = "frm_individual_case" ''Check to see if the individual case form is open. If it is not open, open it. If Not SysCmd(acSysCmdGetObjectState, acForm, FormName) Then DoCmd.OpenForm FormName End If ''Define the form object and Recordset object for the Products 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 the current record in the subform. RS.FindFirst SyncCriteria ''If a record exists in the Products form, find the matching 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]) ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
Thread Tools | |
Display Modes | |
|
|