473,493 Members | 4,319 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Open a form from a form based on two criteria

93 New Member
I have a database that has a client number with multiple records each with unique numbers. I want to "Bop Around" between the two forms as follows:

The forms filter back and forth based on the client number however if I am on record 19-19-19 when I go back and forth I want to land on the record I am working on in the alternate form. Basically I want to maintain my filter and go to a specific record. Any suggestions.
Apr 30 '08 #1
14 2626
PianoMan64
374 Recognized Expert Contributor
I have a database that has a client number with multiple records each with unique numbers. I want to "Bop Around" between the two forms as follows:

The forms filter back and forth based on the client number however if I am on record 19-19-19 when I go back and forth I want to land on the record I am working on in the alternate form. Basically I want to maintain my filter and go to a specific record. Any suggestions.
I would need more infromation in order to be able to answer your question.

Normally when you have multiple forms open, there has to be some kind of updating that needs to happen when you're clicking between forms.

I order to be able to answer your questions, you're going to have to provide more details of how the forms are setup and what the relationship betwen all the tables involved are?

So if you would post Table Structure, Queies writtten, Code used in the forms? Anything that would give me some clue as to what you have so far and what you're trying to accomplish.

Hope that helps,

Joe P.
Apr 30 '08 #2
clloyd
93 New Member
They are the same table one form holds the detail on the record and the other form is simply used as a means to organize the order the records print in, open dates, close dates, etc. in more of a list format so it is easier to read without scrolling a large form. In this table you can have multiple customers that also have multiple incidents. This is the code I have right now to try and "bop around" from one form to the other. It filters the customer but takes me to the first record. If I am updating the 10th incident, which has a unique number, I want it to take me to the incident number I am working on within that filtered customer in the other form. Does that make sense?
Expand|Select|Wrap|Line Numbers
  1. Private Sub RecOpen_Click()
  2. On Error GoTo Err_RecOpen_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "frmCustomerRecord"
  8.  
  9.     stLinkCriteria = "[ClientNo]= '" & Me.[ClientNo] & "' "
  10.     DoCmd.GoToRecord "[IncidentNumber] = " & Me.[IncidentNumber] & "' "
  11.  
  12.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  13.  
  14. Exit_RecOpen_Click:
  15.     Exit Sub
  16.  
  17. Err_RecOpen_Click:
  18.     MsgBox Err.Description
  19.     Resume Exit_RecOpen_Click
  20.  
  21. End Sub
Apr 30 '08 #3
NeoPa
32,556 Recognized Expert Moderator MVP
Please remember to use the [ CODE ] tags provided as this makes reading and understanding a lot easier.

Admin.

As to your explanation, you may want to reread Joe's request for information again. As a third party, I still find your request very confusing (and it doesn't provide the information requested).
May 1 '08 #4
clloyd
93 New Member
Please remember to use the [ CODE ] tags provided as this makes reading and understanding a lot easier.

Admin.

As to your explanation, you may want to reread Joe's request for information again. As a third party, I still find your request very confusing (and it doesn't provide the information requested).
I am new at this I don't understand what you mean by [code]
May 1 '08 #5
clloyd
93 New Member
I must not explain this well previously so I will attempt it again.

I have one table that has multiple entries for one customer. The customer detail is not stored in this table. This table simply stores Incidents or say inventory to make it more generic.

The table in question can have 100 entries for a particular customer however the Incident Number is unique and not duplicated with a customer set however the same Incident Number is not unique within the table and can be used for another Customer number.

For this table I have two forms One is the entire Incident information however it is a large form and with 100 records for one customer we needed a way to organize each incident in more of a list format to see only selective fields in a more organized fashion.

Imagine you had a list of book titles and you had to assign numbers for 100 books in order of 1 to 100 so they appeared in a report in that order. That is what the second form is used for.

A user can be in record 50 in the main form and have to go to the Incident Form to assign a Priority number when he/she goes back to the main form they do not want to scroll through 100 records to find the entry they were working on in the Incident form and visa versa.

This is the code I have so far. Thanks in advance.
Expand|Select|Wrap|Line Numbers
  1. Private Sub RecOpen_Click()
  2. On Error GoTo Err_RecOpen_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "frmCustomerRecord"
  8.  
  9.     stLinkCriteria = "[ClientNo]= '" & Me.[ClientNo] & "' "
  10.     DoCmd.GoToRecord "[IncidentNumber] = " & Me.[IncidentNumber] & "' "
  11.  
  12.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  13.  
  14. Exit_RecOpen_Click:
  15.     Exit Sub
  16.  
  17. Err_RecOpen_Click:
  18.     MsgBox Err.Description
  19.     Resume Exit_RecOpen_Click
  20.  
  21. End Sub
May 1 '08 #6
NeoPa
32,556 Recognized Expert Moderator MVP
I'll assume that you are having difficulty using the [ CODE ] tags rather than just ignoring my instructions.

When submitting a post, there is a [ CODE ] tag button visible (It looks like a # and shows CODE when you hover the mouse over it).

The easiest way to use it is to enter your code, select it, then click on the button. The selected text will be enclosed in these tags and the resultant post will be formatted as for code.
May 1 '08 #7
NeoPa
32,556 Recognized Expert Moderator MVP
I am new at this I don't understand what you mean by [code]
Sorry. I missed this earlier, so now I'm sure you weren't ignoring me :) The instructions remain the same though and should help for next time.
May 1 '08 #8
clloyd
93 New Member
If you read my earlier response I did not know what you meant. I now see to the right on this screen an explanation. I am new at this and just typed not looking to the right of the reply box. I now understand that I need to put
Expand|Select|Wrap|Line Numbers
  1.  before and after the code I am having trouble with 
. I will use that in the future. Sorry if I caused any problem.
May 1 '08 #9
NeoPa
32,556 Recognized Expert Moderator MVP
Actually, your earlier post was a perfect response in the circumstances. I'm sorry I missed it.

You're fine :)
May 1 '08 #10
clloyd
93 New Member
I still have not resolved this issue. Any ideas?
Jul 3 '08 #11
Annalyzer
122 New Member
This sounds very much like what I was trying to do. I had way too much data for each record to put on one form, so I created multiple forms and used the same code you were using. It was marginally successful, but then I found out about "tab controls" and discovered that Microsoft is wayyyyyyy better at this than I am. =)

Check into tab controls. They're awesome!
Jul 3 '08 #12
clloyd
93 New Member
I use tab controls as well. That will not solve this problem. Please look at the following code which is returning a Syntax error and I would greatly appreciate if anyone can see what I am not please. Thanks

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Private Sub RecOpen_Click()
  4. On Error GoTo Err_RecOpen_Click
  5.  
  6.     Dim stDocName As String
  7.     Dim StLinkCriteria As String
  8.  
  9.     stDocName = "frmRec"
  10.  
  11.     StLinkCriteria = "[Client No]=" & Forms![frmRec]![Client No] & " And [RecNo] = '" & [RecNo]
  12.     DoCmd.OpenForm stDocName, , , StLinkCriteria
  13.  
  14. Exit_RecOpen_Click:
  15.     Exit Sub
  16.  
  17. Err_RecOpen_Click:
  18.     MsgBox Err.Description
  19.     Resume Exit_RecOpen_Click
  20.  
  21. End Sub
  22.  
  23.  
Jul 14 '08 #13
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi. In line 9 you have a missing single quote - you have an opening single quote before your reference to field Recno but no closing quote.

If Recno is a number you don't need the quotes at all. If it is a string then you need to add a closing quote like this:

Expand|Select|Wrap|Line Numbers
  1. StLinkCriteria = "[Client No]=" & Forms![frmRec]![Client No] & " And [RecNo] = '" & [RecNo] & "'"
It helps us if you would tell us which line is giving you a syntax error - saves us looking in the wrong places for non-existent errors.

You could also get in the habit of compiling your code after making changes, as any errors introduced in doing so will be caught by the compiler.

-Stewart
Jul 14 '08 #14
clloyd
93 New Member
Thanks that worked. I am still struggling with it though as I want it retain my filter from the other form. I just takes me to that record within all my records. Thanks
Jul 16 '08 #15

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

Similar topics

12
2114
by: Christoph Bergmann | last post by:
Hi... We want to write an open source web based TEXT editor and would be happy about any help ;-) Please notice: We do NOT want to write a web based WEB editor, where you can edit a web...
1
462
by: Konstantin | last post by:
Can someone help me figure out a way to open a form only once in an MDI app. I have an MDI app that contains several forms. I use each form depending on the type of document that the user needs...
6
25638
by: lauren quantrell | last post by:
I have a command button on a continuous subform and I want the user to click it to open a small popup form that opens in the position of the mouse (which is the same as the position of the command...
14
3737
by: Simon Abolnar | last post by:
I would like to know how to open child form from dialog form. Thanks for help! Simon
6
2480
by: James White | last post by:
I wish to open a form using a variable derived from a table. The Application is based on the switchboard principle from Access. However in the absence of do.cmd openForm, I have to use this code....
1
2497
by: DoctorV3774 | last post by:
I need a function to do the following when opening a Form named NewFrm_MainTemplate. I need the function to look at the user id of the person attempting to open the form. Their Windows user ID...
1
1787
lwwhite
by: lwwhite | last post by:
When a user clicks OK on form "SelectDefaults," I want to open form "Welcome" if the results of query "qry_todo_overdue" = 0 or form "OverdueToDo" if the results >= 1. First, I assume that I need to...
3
1448
by: Rudemusik | last post by:
Hello all! Working in vb.net, with VS 2003. I have 2 projects in a solution. Pretty much a client server setup. Project A controls when a message box open up on Project B. Click a button on A,...
5
5472
by: BD | last post by:
I am coding with C# in Visual Studio 2005 for a database application residing on remote MS SQL Server 2005. What I want to do is open the same form but from 2 different places and only one...
4
2256
by: Martin Bentler | last post by:
I have a form that is locked for editing, adding or deleting. Through the use of a command button I open another form, that allows editing, plus allows the user to other areas of the database,...
0
7118
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
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4886
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
4579
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
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
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.