473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How do I set a link or macro up on one form to bring up another?

Thanks for your help and advice in advance!

I have a datasheet form (List) that I'd like to be able to be able to click on the ID number and have it bring up another form (Details) for data entry.

I've tried setting up a macro and a hyperlink but what I end up with when I click on ID is the Details form with all the records in the DB. I just want it to bring up the one record to edit without the possibility of bringing up any other records for control purposes.

Can someone help walk me through this? Thanks.
Nov 14 '09 #1

✓ answered by orangeCat

@Missionary2008
I'm not sure what your experience level is, but I sent the database so that you could see how clicking a record on one form would open a new form with details of the record you clicked on.

In frmList, there is a field "productcode". That field (control) has an private procedure related to the Onclick event.

Expand|Select|Wrap|Line Numbers
  1. Private Sub ProductCode_Click()
  2. '
  3. 'When you click in the productCode field, this Sub
  4. 'will cause Form frmDetails to Open, and
  5. 'it will open displaying current entires for this Product code
  6. 'You can alter or enter new data in all fields except the product code field.
  7.  
  8. DoCmd.OpenForm "frmDetails", acNormal, , "Productcode = " & Forms!frmList.ProductCode
  9. End Sub
  10.  
This Sub does the following:

When you click on a record (the productcode in frmList), frmDetails is opened in Normal mode and the record it displays is the one that has its
ProductCode = to the Productcode you clicked on on form frmList.

To see this code, open frmList in design mode;
right click on the ProductCode field,
click Properties,
click Event,
Go to the OnClick event;
Click on the ellipses (.....) at the end of the line.

Good luck

8 3049
orangeCat
83 64KB
@Missionary2008
I set up a small database - called ForBytes.mdb - that you can download at
http://www.4shared.com/dir/11648478/...0/sharing.html

It has a Table Product, and 2 forms - frmList and frmDetails.

Opening frmList will list all ProductCodes from table product.
If you click on a ProductCode on frmList, it will open frmDetails with a display of the field and values for that ProductCode,

Hope it helps, but I'm not sure exactly what you're trying to do.
The forms in the mdb do what you said, but I don't think that will get you very far.
Nov 14 '09 #2
orangeCat,

Thanks for the response - that is exactly what I'm wanting my forms to do. Right now - when I click on the frmList it pulls up all the records from frmDetails. How do I get it to just rbing up the from for the one record I want to edit/look at?

Thanks in advance.
Nov 15 '09 #3
orangeCat
83 64KB
I'm not sure how, when clicking on a specific record in frmList, you're getting all records in frmDetails. That's not what's happening when I click on a record in frmList. In fact, the OpenForm command is specifcally restricting frmDetails to that record with the same productcode as the record you clicked on in frmLst.

Please explain.
Nov 15 '09 #4
orangeCat,

It works on the db you created but no in mine.

I have a form entitle frmLists. when I open it - all the record are in datasheet view. I want to be able to click on the ID to bring up frmDetails just like it does in your db.

I've tried to use the embed a macro function bu (in the design view of the frmList) t when I do - it does open the frmDetails form - with all the records in my database and it always starts with the first record. I want it to open to frmDetails with only the record I click on in the frmList form.

How can I make the db open a different from when I click on the ID number in another form?
Nov 15 '09 #5
orangeCat
83 64KB
@Missionary2008
I'm not sure what your experience level is, but I sent the database so that you could see how clicking a record on one form would open a new form with details of the record you clicked on.

In frmList, there is a field "productcode". That field (control) has an private procedure related to the Onclick event.

Expand|Select|Wrap|Line Numbers
  1. Private Sub ProductCode_Click()
  2. '
  3. 'When you click in the productCode field, this Sub
  4. 'will cause Form frmDetails to Open, and
  5. 'it will open displaying current entires for this Product code
  6. 'You can alter or enter new data in all fields except the product code field.
  7.  
  8. DoCmd.OpenForm "frmDetails", acNormal, , "Productcode = " & Forms!frmList.ProductCode
  9. End Sub
  10.  
This Sub does the following:

When you click on a record (the productcode in frmList), frmDetails is opened in Normal mode and the record it displays is the one that has its
ProductCode = to the Productcode you clicked on on form frmList.

To see this code, open frmList in design mode;
right click on the ProductCode field,
click Properties,
click Event,
Go to the OnClick event;
Click on the ellipses (.....) at the end of the line.

Good luck
Nov 15 '09 #6
orangeCat

Thanks for your help - that last post helped out a lot. My experience is very limited as I'm still learning.

God bless.
Nov 15 '09 #7
orangeCat
83 64KB
@Missionary2008
Glad to help.
Here are some links to valuable Access Tips

1:http://www.fontstuff.com/siteindex.htm#access (tutorials an samples)
2: http://www.allenbrowne.com/casu-22.html (video and text)
Nov 15 '09 #8
Great - Thanks! I appreciate the help.
Nov 15 '09 #9

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

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
2
by: James Robinson | last post by:
We have multiple databases created with forms in them. I want to create a master form that can link to any of the other database forms. If you have all of the tables and forms, ect., in one...
0
by: RookieCard | last post by:
I've been stuck on this for 2 days. Here's the deal. I am working (3 levels down/deep)in a subform within a tab object that is within another tab obeject. Everything works great! Except here: 1)...
1
by: meganrobertson22 | last post by:
Hi Everyone- I am trying to use a simple macro to set the value of a combo box on a form, and I can't get it to work. I have a macro with 2 actions: OpenForm and SetValue. I can open my form,...
2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
3
by: rdemyan via AccessMonster.com | last post by:
I just got Access 2003 and have been playing around with it. This whole macro security thing can be a bit annoying. Initially, I was able to link to my backends located on a second computer....
4
by: ApexData | last post by:
Hello 1- What is the AutoExec Macro? Is it the same thing as AutoKeys Macro? 2- I'm looking to Control Keys equally on startup for my entire app. I understand that the AutoKeys Macro is the...
0
by: colleen1980 | last post by:
Macro and button all works fine. It goes to other database and open the form from their. Now only problem is that there are two forms link to each other. When i click on the button it works fine...
3
MMcCarthy
by: MMcCarthy | last post by:
Although some users find Macros simple and easy to use, there are some major limitations to using them. Although you can use macros to perform tasks, there is limited control on when and how those...
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
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...
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
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...

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.