Topics Search

StLinkCriteria - 2 fields

StLinkCriteria - 2 fields
Views: 190
I'm building an Event at Access to visualize a report (called Carttoes) linked to the data of two fields: [codigorodada] and [caixas].
I only know how to set the linking criteria for one field, how could I put the StLinkCriteria for both fields? ...
Sponsored Links:

More topics

 

Search 3 fields from one unbound field

Preview
Basically what I'm trying to do is make a search form that will open another form from the search form that will match the records if the data was from any of the three fields.

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Main Case Details"
stLinkCriteria = "[Serial Number]=" & "'" & Me![Search] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Is the code I use to match (via onclick) from one to another

is there a simple way, to add the following to the code, so it will search the other two fields as well?

stLinkCriteria = "[Received by Agency Inventory #]=" & "'" & Me![Search] & "'"
stLinkCriteria = "[CFU Inventory ID]=" & "'" & Me![Search] &amp
 

type mismatch error?

Preview
I am trying to run this function

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Business"
stLinkCriteria = "[Numero_PA]=" & Me! [List_Participants] And "[SK_Year]=" & Me![Combo92]
DoCmd.OpenForm stDocName, , , stLinkCriteria

and I get the type mismatch error. I have looked up the fields in the tables and all of them are set to number. any ideas as to whats going on?
 

Multiple Field Matching with Macro

Preview
I want to have a form where I use a click button to open a new form which will then match all fields to narrow down the results.

The standard function only uses one matching point I tried more but it does not work:
Private Sub Command24_Click()
On Error GoTo Err_Command24_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "RECAP"

stLinkCriteria = "[ISIN]=" & "'" & Me![ISIN:] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command24_Click:
Exit Sub

Err_Command24_Click:
MsgBox Err.Description
Resume Exit_Command24_Click

End Sub
There are a total of 5 fields
 

Yet another filter issue :(

Preview
Button currently open a new form for records where thefield [Position] has a value of "Staff'

Private Sub cmdStaffLookup_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPeopleList"
stLinkCriteria = "[Position]= 'Staff'"
DoCmd.OpenForm stDocName, , , stLinkCriteria End Sub

but I need it also to only show records where the field [Inactive] is "true" (0)

I tried using AND at the end of the stLinkCriteria
 

Reusable Popup form to edit memo fields

Preview
I have a form with a few memo fields. The form is not big enough to allow users to edit these memo fields very well. So I created a new form with just one big text box and have the form pop up when the user double clicks one of the memo fields from the previous form. Looks like this:

stDocName = "frmInputMemo1"
stLinkCriteria = "[AfieldID]=" & Me![AfieldID]
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria

The popup form "frmInputMemo1" is bound to the table and field that the user wanted to edit.
This works, but just for that one memo field. I would have to create more popup forms to allow the same for the other memo fields.

How can I do this same thing but reuse the same popup form for all the memo fields
 

Missing Operator error

Preview
I'm getting a missing operator error.

here is my code can anyone help me figure out why

Private Sub Editloc1_Click()
On Error GoTo Err_Editloc1_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Edit Document Out File"

stLinkCriteria = "[Quarter]=" & Me![Quarter]
stLinkCriteria = "[QTR Acct Nbr]=" & Me![QTR Acct Nbr]
stLinkCriteria = "[Exception Type] =" & Me![Exception Type]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Editloc1_Click:
Exit Sub

Err_Editloc1_Click:
MsgBox Err.Description
Resume Exit_Editloc1_Click
 

Passing value from one form to another

Preview
I am sure that this question has been asked many times, but I cannot seem to find an answer that works. I have two forms, Form1 looks at tblChristmasCard field called CN_ID. I have created a cmd button, which opens frmAddMeToTheList with stLinkCriteria, and I want the new record to be populated with CN_ID from Form1.

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAddMeToTheList"
stLinkCriteria = "[CN_ID] =" & "'" & Me![CN_ID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Form_frmFRONTSHEET.CN_ID = Form_frmAddMeToTheList.CN_ID
 

Select record in list box and open form populated with that record

Preview
For search form, n list box to filter the record. What I really want is to double click the highlighted record to display full record which in other form.

Dim stDocName As String Dim stLinkCriteria As String
stDocName = "USER"
stLinkCriteria = "[Service Tag]=" & Me![search]
DoCmd.OpenForm stDocName, , , stLinkCriteria

However, the code run to be error at stLinkCriteria. I don't know how to configure the problem since I just copied the code from my research. or do I have another way so I can display the selected record from listbox.
 

Syntax error missing operator(3075)

Preview
I'm kinder of new to access and I need help finding out what is wrong with the following VB coding.
I created a report from a query to search a specific record based on analyst name
I created a search from and out combo box to select the name and it will display the report with the name called.

Private Sub Command2_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Search_Report"
stLinkCriteria = "[AnalystName]=" & Me![CboAnalyst]

stLinkCriteria = "[Analyst_Name]=" & Me![CboAnalyst]
DoCmd.OpenReport stDocName, , , stLinkCriteria
Exit_Command2_Click:
Exit Sub

The analyst name on the report is in this format(john smith). Im not sure if this is the reason why I'm getting this error message
 

Open form to filtered records

Preview
Access 2003
Win XP - Win 7

I need to open the form "frmPeopleList" filtering the field "Position" to only those with values of "Staff".

From a button with this code:

Private Sub cmdFilter2_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPeopleList"
stLinkCriteria = "[Position]=" & "Staff"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub

the above code seems to work but with a parameter box popping up prompting you to type "Staff"

I am assuming the following line of code needs some tweaking:

stLinkCriteria = "[Position]=" & "Staff