Ok, I have several different record types in a table which are differentiated by a field which assigns what each record belongs to. There are "equip" records and "eng" records.
On a form that displays a filename ("frm_hardcopies"), the field is called "Filename". The equip and eng files are maintained in 2 seperate forms, but both contain the filename value. If I double click on frm_hardcopies.Filename, would it be able to look at tbl_documents.Path (which is the linked filename field), and if that record's "doc_filter" value is "equip", it would open frm_equip_docs, or if the "doc_filter" value is "eng" it would open frm_eng_drawings and go to the appropriate record? The "doc_filter" field is only in tbl_documents, not in tbl_hardcopies.
This is the only code I have so far, which just opens 1 of the forms based on the filename. It doesnt look at the filter criteria yet. - Private Sub Filename_DblClick(Cancel As Integer)
-
-
On Error GoTo Err_Path_Click
-
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
stLinkCriteria = "Path = '" & Me.Filename & "'" 'Assuming that the value you want is in the Path field
-
-
-
stDocName = "frm_equip_docs"
-
DoCmd.OpenForm stDocName, , , stLinkCriteria
-
-
-
Exit_Path_Click:
-
Exit Sub
-
-
Err_Path_Click:
-
MsgBox Err.Description
-
Resume Exit_Path_Click
-
-
End Sub
8 4330 NeoPa 32,556
Expert Mod 16PB
I expect it can be done but it's so hard to know without a much better idea of what you're working with. I suggest some Meta Data would help this along. A full description of the data structure and form structure you're working within.
Here is an example of the sort of thing I'm talking about : Table Name=[tblStudent] - Field Type IndexInfo
-
StudentID AutoNumber PK
-
Family String FK
-
Name String
-
University String FK
-
Mark Numeric
-
LastAttendance Date/Time
ok, frm_hardcopies.Filename contains the value that will call to and load either frm_equip_docs.Path OR frm_eng_drawings.Path based on the record value of tbl_documents.Path's corresponding value in the field "doc_filter". If doc_filter = equip Then it would open frm_equip_docs based on - stLinkCriteria = "Path = '" & Me.Filename & "'"
, ELSEIF doc_filter = eng Then it would open frm_eng_drawings based on - stLinkCriteria = "Path = '" & Me.Filename & "'"
NeoPa 32,556
Expert Mod 16PB
So, if it's one way it does one thing, and if it's the other it does exactly the same thing?
I'm not sure this helps much to clarify the situation. I was expecting a clarification of the filtering - hence the requirement for meta data (which is still outstanding btw).
no, if its 1 way it should open formA. if if the other way it should open FormB. the value in tbl_documents.doc_filter would tell it which form to open
NeoPa 32,556
Expert Mod 16PB
Now I'm really confused. Are you telling me someting is different between the two lines of code posted in post #3, or am I to understand your way of clarifying the situation was to illustrate only the part where they are similar? Twice?
Still no meta data. Still miles from clarity.
nevermind, I got it. I created a hidden dropdown linked back to tbl_documents that pulled up the Path and doc_filter info. The control source for the dropdown is [Forms]![frm_hardcopies]![Filename]. Then, based on the value in the 2nd column of the dropdown (doc_filter), the DblClick event opens the form accordingly. It works so far, however when I go to the next record on frm_hardcopies and try clicking on the field again, nothing happens. I have to figure out how to refresh the event or something so it works every time I use it - Private Sub Filename_DblClick(Cancel As Integer)
-
-
On Error GoTo Err_Path_Click
-
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
stLinkCriteria = "Path = '" & Me.Filename & "'" 'Assuming that the value you want is in the Path field
-
-
If filt_form.Column(1) = "equip" Then
-
-
stDocName = "frm_equip_docs"
-
DoCmd.OpenForm stDocName, , , stLinkCriteria
-
-
ElseIf filt_form.Column(1) = "eng" Then
-
-
stDocName = "frm_eng_drawings"
-
DoCmd.OpenForm stDocName, , , stLinkCriteria
-
-
End If
-
-
-
Exit_Path_Click:
-
Exit Sub
-
-
Err_Path_Click:
-
MsgBox Err.Description
-
Resume Exit_Path_Click
-
-
End Sub
got that too. I added Refresh before setting Dim in the VBA
NeoPa 32,556
Expert Mod 16PB
Congratulations then I guess. I'm pleased you managed to find a solution, but I worry you won't get the best of help in future unless you work out how to ask your questions more clearly. We'll leave that for now though as you got a solution instead. Well done.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dom Nicholas |
last post by:
Hi,
I have a table (inside a form) that is dynamically created ie the user
can add / remove rows dynamically. Each table row has 4 columns :
a selection pull down list
a text field for...
|
by: steph |
last post by:
Hello,
I've got a text field in an access form (Microsoft Access 2002, SP3),
that the user has to fill out. Now I don't want the user to leave this
field (and this record) until he has filled...
|
by: Pupkin |
last post by:
Hi,
Is there any kind of built-in control for a dropdownlist with a
contextual text field option?
For example:
Choose one:
This
|
by: starke1120 |
last post by:
Is there a way to open a form based on query type.. Example..
If a certain query result is 1 then open the form to this result..
If the query results are NULL or 0 results, then open open for...
|
by: Markus_989 |
last post by:
I have a LOANS table that has a list of loan details for different
borrowers. I have a main switchboard with a LOANSELECT combo box
(that displays a list of borrower last names and loan numbers)....
|
by: Kevin |
last post by:
The menu form has two options, one to create a new estimate, the second to
open an existing estimate.
Under option two is a list box containing all of the estimates. There are
several different...
|
by: Beatrice |
last post by:
I need to open a form selecting all data from a previous form i.e:
Form 1)
combo box 1 named "cboYearSelect" displayed as "Year" based on qry QryYearList ( only one field "Year")
...
|
by: kcdoell |
last post by:
Hello:
I have two fields on a table that is displayed on my continous form.
GWP = Number
Binding Percentage = Text (a value list of 25%, 50%, 90% & 100%)
I have a unbound text box that I...
|
by: Mihail |
last post by:
I have some global variables.
I use this variables to open a form based on a query with parameters.
Now I use the On Load event to prepare an SQL string which include values of the global...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
| |