StLinkCriteria
Dec 14, 2006
I can't seem to combine these to one button. I need to open a form based on the values in two fields.
Seperatly they work, when i try to combine them using the AND function it comes up with the error data mismatch.
Private Sub cmdEvidenceSummary_Click()
On Error GoTo Err_cmdEvidenceSummary_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "F_EvidenceSummary"
stLinkCriteria = "[Unit]=" & Me![Unit]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdEvidenceSummary_Click:
Exit Sub
Err_cmdEvidenceSummary_Click:
MsgBox Err.Description
Resume Exit_cmdEvidenceSummary_Click
End Sub
Private Sub Command28_Click()
On Error GoTo Err_Command28_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "F_EvidenceSummary"
stLinkCriteria = "[Identifier]=" & Me![Candidate]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command28_Click:
Exit Sub
Err_Command28_Click:
MsgBox Err.Description
Resume Exit_Command28_Click
End Sub
Any advice?
this is what i have but with the error
Private Sub cmdEvidenceSummary_Click()
On Error GoTo Err_cmdEvidenceSummary_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "F_EvidenceSummary"
stLinkCriteria = "[Identifier]=" & Me![Candidate] And "[Unit]=" & Me![Unit]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdEvidenceSummary_Click:
Exit Sub
Err_cmdEvidenceSummary_Click:
MsgBox Err.Description
Resume Exit_cmdEvidenceSummary_Click
End Sub
View Replies
Feb 2, 2006
Hi,
I am using the following syntax to link one form to another.
Private Sub btnOpenPractice_Click()
On Error GoTo Err_btnOpenPractice_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PRACTICE"
stLinkCriteria = "[PracticeName]=" & "'" & Me![GroupName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
GroupName field in the current form links to PracticeName field in the Practice form. The syntax works fine and it does open the Practice form. But when the Practice Name has a quote in it such as "Frank's Practice", it gives me an error "Syntax error (missing operator) in query expression '[PracticeName]='Frank's Practice",
I don't what that means or how to fix it. Can anyone provide me with some guidance on this. Thanks.
View 14 Replies
View Related
Dec 28, 2004
In solution i have a button (see code). I moved the database and, of course, get an error. "Ogiltig sökväg, 'G:osv. osv'." Swedish for "No valid path".
Where do i change the path, since it´s not set in the script?
PHP Code:Private Sub Kommandoknap25_Click() On Error GoTo Err_Kommandoknap25_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "ny kundebank" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_Kommandoknap25_Click: Exit Sub Err_Kommandoknap25_Click: MsgBox Err.Description Resume Exit_Kommandoknap25_Click End Sub
Rgds
thomas
View 1 Replies
View Related
Dec 17, 2006
Hi
I have a form(Enquiry) which contains a subform(site) which are locked to prevent data being changed.
When a button is clicked I would like to open the currently viewed customer's details and site details in another form called: EDITEnquiry which is not locked.
I have managed to do this using one field(CustomerID) but am having trouble using two fields. - One being on the subform.
The code bellow provides me with the following error message:
Syntax error (missing operator) in query expression '[CustomerID]=2 And [Address] = 123 Site Road'.
Private Sub Edit_Click()
On Error GoTo Err_Edit_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "EDITEnquiry"
stLinkCriteria = "[CustomerID]=" & Me![CustomerID] & " And [Address] = " & Me!EnquirySiteSubform![Address]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Edit_Click:
Exit Sub
Err_Edit_Click:
MsgBox Err.Description
Resume Exit_Edit_Click
End Sub
Thanks in advance
View 14 Replies
View Related
Mar 1, 2007
Can someone please tell me what is wrong with this code? I'm using a "Search" form to open a specific record in another form. Right now, I'm getting errors about data mismatch.
Also, I have no comprehension of the quotation marks and apostrophe usage in code. Would someone please enlighten me? Thank you, thank you, thank you!!! Here's the code.
Private Sub Command2_Click()
Dim frmName As String
Dim stLinkCriteria As Integer
frmName = "frmMainCustomerPage"
stLinkCriteria = "[Customer ID] ='" & "Me![Customer ID Search]'"
DoCmd.OpenForm frmName, acNormal, , , stLinkCriteria
Exit_Command2_Click:
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
Thanks again!
KellyJo
View 6 Replies
View Related
Sep 22, 2004
I have made two forms which I use to find particular records on another form and one works and the other doesn't. I can't figure out why one works and the other doesn't.
The working code is:
Private Sub Project_List_DblClick(Cancel As Integer)
On Error GoTo Err_Project_List_DblClick
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Project Details Form"
stLinkCriteria = "[Project No]=" & "'" & Me![Project List] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Project List", acSaveNo
Exit_Project_List_DblClick:
Exit Sub
Err_Project_List_DblClick:
MsgBox Err.Description
Resume Exit_Project_List_DblClick
End Sub
[Project No] is the primary key in the Project Details. Also, it's the bound to column in the [Project List] list box.
The non-working code is:
Private Sub Assessment_List_DblClick(Cancel As Integer)
On Error GoTo Err_Assessment_List_DblClick
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Site Assessment Details"
stLinkCriteria = "[Assessment ID]=" & "'" & Me![Assessment List] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Site Assessment List", acSaveNo
Exit_Assessment_List_DblClick:
Exit Sub
Err_Assessment_List_DblClick:
MsgBox Err.Description
Resume Exit_Assessment_List_DblClick
End Sub
[Assessment ID] is the primary key in the Site Assessment Details and the bound to column in the [Assessment List] list box. One difference between the two is that the Assessment ID is a column of 0" width in the list box of Assessment List and a hidden text box in Assessment Details. Assessment ID is a autonumber field. I've tried to make the column have a width and show the ID on the details form and it hasn't seemed to make any difference.
Any ideas about what the key difference is?
Thanks
View 2 Replies
View Related