A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

SyncCriteria = BuildCriteria problem



 
 
Thread Tools Display Modes
  #1  
Old May 28th, 2004, 06:06 PM
jayglass
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:15 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.