How to open different forms with on same records using Hyperlink data type in Access? (1 Viewer)

jamilmurad

New member
Local time
Today, 13:29
Joined
Oct 24, 2012
Messages
9
Hello guys;
this is my first post in this forum. Actually I have a database with multiple forms; among them there is a form named Bill with a subform named Test so, there are multiple test records represented by TestID under a BillID. In Test subform, I have a hyperlink data type filed named Test which holds the names of laboratory tests and there are multiple forms with these test value names so when I click on a value it opens the form with the same name that works fine but, there is a problem, it opens the form on record 1 while I want it to open the form on the same BillID as BillID is also there on those form.
kindly help me to solve the problem.
thanks.
 

MarkK

bit cruncher
Local time
Today, 13:29
Joined
Mar 17, 2004
Messages
8,186
Hi and welcome to the forum. Please only post your question once.
Thanks,
Mark
 

moke123

AWF VIP
Local time
Today, 16:29
Joined
Jan 11, 2013
Messages
3,933
why a hyperlink?
Are you using docmd.openform method?
what is your code?
 

jamilmurad

New member
Local time
Today, 13:29
Joined
Oct 24, 2012
Messages
9
Thanks morek123
my aim behind using hyperlink data type is to open relevant Form based on the values of Test field. I am not using Docmd.openform as I don't want to limit the link to a single form rather to different forms based on Test values for example when I enter MP as data in Test filed then clicking MP opens MP form automatically in the same way there are other 40 forms named with laboratory tests such as Widal, Typhi Dot, Dengue etc.These forms also have bill information such as BillID but they open on record 1 rather than on same ID number.
Regards.
 
Last edited:

moke123

AWF VIP
Local time
Today, 16:29
Joined
Jan 11, 2013
Messages
3,933
I am not sure i'm following you correctly.
I am not a fan of hyperlink datatype as I find they are more trouble than they are worth and as such I never use them. Its much easier to use code to open a link. That said, i am unaware of any way to pass a record ID to the opening form. I suppose you could construct a filter in the opening form but that seems more trouble than its worth.

if i'm following what your saying, are you typing in the form name and then clicking on it to open it? if so, what happens when you misspell it?

the way to do this would be a combobox or listbox with the form names and then using the docmd.openform method using the form name and passing the BillID in the where condition.
 

jamilmurad

New member
Local time
Today, 13:29
Joined
Oct 24, 2012
Messages
9
thanks for your reply.
if I misspell then clicking on it does not open any form.
will you guide me through coding (by using a button as suggested by you) to do what I want to achieve?
Regards
 

moke123

AWF VIP
Local time
Today, 16:29
Joined
Jan 11, 2013
Messages
3,933
still not sure if i'm following what you want.
it doesnt make sense that you would type in a form name since they are known entities.
heres an example of how you would use the open form method with a combobox or listbox to open a specified form.

maybe if you post an example of what you want it would be clearer.
 

Attachments

  • example_Forms.zip
    31.8 KB · Views: 61

jamilmurad

New member
Local time
Today, 13:29
Joined
Oct 24, 2012
Messages
9
Thanks a lot moke123
the example file you provided gave me the idea to solve my problem. This is what I wanted to achieve through a Hyperlink, which was a wrong idea.
regards
 
Last edited:

jamilmurad

New member
Local time
Today, 13:29
Joined
Oct 24, 2012
Messages
9
hello guys thanks for your help and support.
I am having another problem with my database which I mentioned earlier;; there are two tables in the database, one is Tests table and the other is Bill table, the Tests table consists of fields; TestID (primary key), Test (contains laboratory tests' names) and a Charges field (contains charges of the tests). The Bill table contains bill information. I have a form in which I display bill information along with Tests information. There is a combobox field through which I select TestID, Test and Charges but it only displays Test field data. I also want to sum charges to be calculated automatically in the form. kindly help me to solve the issue.
thanks
 

Users who are viewing this thread

Top Bottom