473,473 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Resetting LinkCriteria after opening form.

6 New Member
Hi,

I was wondering if anyone could help?!

I have a button on one form (Participant form) that opens another form at a specific record (Learning Session form with specific session for that participant). After opening to that specific learning session I can't move to a different learning session. I was wondering if there was someway to 'reset' the LinkCriteria so that the Learning Session form can move between records.

Sorry if this is confusing, but any help would be greatly appreciated.

Thanks!

Kira
Nov 6 '07 #1
7 2065
JustJim
407 Recognized Expert Contributor
Hi,

I was wondering if anyone could help?!

I have a button on one form (Participant form) that opens another form at a specific record (Learning Session form with specific session for that participant). After opening to that specific learning session I can't move to a different learning session. I was wondering if there was someway to 'reset' the LinkCriteria so that the Learning Session form can move between records.

Sorry if this is confusing, but any help would be greatly appreciated.

Thanks!

Kira
Hi,

I presume since you use the term LinkCriteria, that you used the wizard to make a button and you ended up with something very like this...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2. On Error GoTo Err_Command0_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "frmTest"
  8.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  9.  
  10. Exit_Command0_Click:
  11.     Exit Sub
  12.  
  13. Err_Command0_Click:
  14.     MsgBox Err.Description
  15.     Resume Exit_Command0_Click
  16.  
  17. End Sub
and that you have assigned stLinkCriteria to a valid Where statement (which the silly wizard doesn't do).

You will then open your form with the underlying records filtered by the Where statement in stLinkCriteria. To see all records, un-click the Apply Filter button on the toolbar.

Does that help?

Jim
Nov 7 '07 #2
mahgnilla
6 New Member
Hi,

I presume since you use the term LinkCriteria, that you used the wizard to make a button and you ended up with something very like this...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2. On Error GoTo Err_Command0_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "frmTest"
  8.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  9.  
  10. Exit_Command0_Click:
  11.     Exit Sub
  12.  
  13. Err_Command0_Click:
  14.     MsgBox Err.Description
  15.     Resume Exit_Command0_Click
  16.  
  17. End Sub
and that you have assigned stLinkCriteria to a valid Where statement (which the silly wizard doesn't do).

You will then open your form with the underlying records filtered by the Where statement in stLinkCriteria. To see all records, un-click the Apply Filter button on the toolbar.

Does that help?

Jim
Thanks Jim, that does help. I was wondering if there is a way to automatically have that filtered turned off every time that form is opened (so that the user doesn't have to un-click the apply filter button)?

Thanks again!
Nov 8 '07 #3
JustJim
407 Recognized Expert Contributor
Thanks Jim, that does help. I was wondering if there is a way to automatically have that filtered turned off every time that form is opened (so that the user doesn't have to un-click the apply filter button)?

Thanks again!
Just don't use the Where (stLinkCriteria) phrase when opening the form.

Jim
Nov 11 '07 #4
mahgnilla
6 New Member
Just don't use the Where (stLinkCriteria) phrase when opening the form.

Jim
Hi Jim,

The problem is that I want the form to open to a specific record, but then I want the user to be able to move to other records. I've tried using the following code and it won't work for some reason:

If ActiveSheet.AutoFilterMode Then
ActiveSheet.AutoFilterMode = False
End If

Any suggestions?

Thanks,
Kira
Nov 13 '07 #5
JustJim
407 Recognized Expert Contributor
Hi Jim,

The problem is that I want the form to open to a specific record, but then I want the user to be able to move to other records. I've tried using the following code and it won't work for some reason:

If ActiveSheet.AutoFilterMode Then
ActiveSheet.AutoFilterMode = False
End If

Any suggestions?

Thanks,
Kira
Hi,
This is probably pretty clunky (I haven't had my second coffee yet) but...

The button on the form which opens the target form should have something like this
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnOpen_Click()
  2. Dim strSearch As String
  3. strSearch = "Surname = '" & Me.txtSearch.Value & "'"
  4. DoCmd.OpenForm "frmTarget", , , , , , strSearch
  5. End Sub
where txtSearch is a text box on that form into which the operator types the person's name or whatever that you want the other form to open with. This opens the second form (frmTarget here but change the code to suit) and the strSearch after the long row of commas puts something like Surname = 'Smith' as the OpenArgs for the second form. OpenArgs (or Tag) is a handy way to pass information between forms, reports etc.

The second form should have in it's On Open event
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. Dim rsClone As DAO.Recordset
  3. Dim strSearch As String
  4.  
  5. Set rsClone = Me.RecordsetClone
  6. strSearch = Me.OpenArgs
  7. rsClone.FindFirst strSearch
  8. If Not rsClone.NoMatch Then
  9.     Me.Bookmark = rsClone.Bookmark
  10. End If
  11. End Sub
Which should do the trick. (you might want to put an Else clause in the If statement to show a message box explaining that the string wasn't found)

Jim
ps ActiveSheet etc is Excel stuff!
Nov 14 '07 #6
tezza98
38 New Member
when the form loads try

Expand|Select|Wrap|Line Numbers
  1. Me.FilterOn = False
does the same thing as the filter button on the top menu

or add a button that executes this code to clear the filter, or use it on the open event
or
[code]
If Me.FilterON = True then
Me.FilterON = False
End If

You see where im going with this, have a play around with it to find the best place to put the code
Nov 15 '07 #7
mahgnilla
6 New Member
Thank you both for your help, I finally figured it out!!

Cheers
Kira
Nov 15 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Greg | last post by:
On my report I want to have an opening balance signifying all transactions up to the month selected and detailed transactions for the month selected and then a closing blance. I'm perpelexed...
2
by: DeveloperPDX | last post by:
I am creating a page and I need to add a reset button (like you would with HTML forms). Is there any way to do this other than resetting individual controls? Basically I need to page to return to...
1
by: Matthew Wieder | last post by:
Hi - I wanted to capture the enter button on a form since I have a datagrid with the first column being a delete button and if someone hits enter it deletes the first record. I coded: private...
4
by: Ian Davies | last post by:
Hello I am struggling for a solution to clear some fields on my webpage that takes their values from some sessions My solution below works when the button is clicked twice. I sort of know why I...
2
by: tshad | last post by:
I have my Application variables getting set in my Global.aspx file. If I change a variable in my table that is read at startup, I need to restart the application to reload the variables. I...
8
by: Kevin | last post by:
I'm using a form where users can input a bunch of info into unbound text controls that are used in series of calculations. At the bottom is a "reset" button. I want to clear out all of the user...
2
by: =?Utf-8?B?TWljaGFlbA==?= | last post by:
Hi Everyone. I was using the following code in VB6, but am in the middle of converting the app to VB.Net 2005. He is the code Private Sub ClearAll() On Error GoTo Error_Routine Call...
0
by: =?Utf-8?B?TWFyaw==?= | last post by:
I'm trying to create a visual aid program to mimic a VIPP layout. In VB.NET the screen origin (0,0) is the top left hand corner of the screen. Is there a way to reset the origin to the bottom left...
2
by: RLN | last post by:
RE: Access 2003 I wanted to turn off right clicking on forms so users couldn't go into design mode and change stuff. I have a special "programmers' form that, when a password is put in, enables...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.