Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Business Applications
Tag Cloud
access acer asus bios bsod computer crash desktop dns driver drivers error ethernet excel freeze gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard network printer problem ram registry repair router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Linking forms in Access

Reply  
Thread Tools
bblakel1's Avatar
Junior Member with 7 posts.
 
Join Date: Nov 2009
19-Nov-2009, 01:13 PM #1
Linking forms in Access
Hello,

I am new here and this is my first post so let me know if I am doing anything incorrectly. I have an Access DB, and I am trying to create a button on one Form that will pull up another Form and display the associated FK. Here is the VB code I have so far, but I know it is missing something. It has been a long time since I have done any VB and I was not great at it then. Any help would be much appreciated.

Private Sub Command21_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "the form I want to retrieve"

stLinkCriteria = "employeeID" = " & Me![employeeID]"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acGoTo, (this is were I get lost)

End Sub
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
19-Nov-2009, 01:27 PM #2
bbalke, welcome to the Forum and the wonderful world of Access.

Your VBA is fine up to this point

DoCmd.GoToRecord , , acGoTo, (this is were I get lost)

What is it that you want the VBA code to do at this point?
The newly opened form should already be displaying the Employee Record(s) that match the EmployeeID.

What version of Access sre you using, if it 2007 it has problems with that particular piece of code.

Have you considered have the second form as a Subform of the First form?
Or having a Tabbed Mainform that shows both forms on it?
__________________
OBP
I do not give up easily
bblakel1's Avatar
Junior Member with 7 posts.
 
Join Date: Nov 2009
19-Nov-2009, 01:44 PM #3
The database has two tables that are linked. One with employee info and one with their PC info. I want to be able to click on the button from the employee info Form and it pull up their PC.

Currently it just pull up the PC Form and it's blank. Could it be the way I have them joined in Access? I am using Access 2003. Thank you very much for the help.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
19-Nov-2009, 01:53 PM #4
Can you show me a Screenshot of your Relationships?

I would go for a Tabbed mainform, the Mainform, based on the Employee table with the EmployeeID and a Find Combo with tab one with Employee Details and tab two with the PC details. You can then just Link the form's by Master/Child Link using the EmployeeID.

If you need advice on how to do the tabbed form feel free to ask
__________________
OBP
I do not give up easily
bblakel1's Avatar
Junior Member with 7 posts.
 
Join Date: Nov 2009
19-Nov-2009, 01:57 PM #5
Here is the .bmp of my relationships.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
19-Nov-2009, 01:59 PM #6
Sorry, it doesn't appear to have attached.
bblakel1's Avatar
Junior Member with 7 posts.
 
Join Date: Nov 2009
19-Nov-2009, 02:03 PM #7
Try #2, I guess Google Chrome still has some clitches. Sorry.
bblakel1's Avatar
Junior Member with 7 posts.
 
Join Date: Nov 2009
19-Nov-2009, 02:07 PM #8
Sorry, user error. The file was too large as a .bmp.
Attached Thumbnails
Linking forms in Access-untitled.png  
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
19-Nov-2009, 02:08 PM #9
Still not there.
Are you using the "Go Advanced" and "Manage Attachment" Buttons?
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
19-Nov-2009, 02:14 PM #10
They look good to me.
Can you take a copy of the database, delete all the records from the copy, Compact & Repair it, zip it and post it on here?
bblakel1's Avatar
Junior Member with 7 posts.
 
Join Date: Nov 2009
19-Nov-2009, 02:31 PM #11
Thank you very much for looking at it. There is not a password on it. The button I am trying to get to work in on the Tech Form (command 21). Thanks again.
Attached Files
File Type: zip DB.zip (79.3 KB, 4 views)
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
19-Nov-2009, 02:50 PM #12
Like this.
Let me know if you want to try a Tabbed Mainform.
Attached Files
File Type: zip DB.zip (73.0 KB, 9 views)
bblakel1's Avatar
Junior Member with 7 posts.
 
Join Date: Nov 2009
19-Nov-2009, 04:17 PM #13
You are my hero. Thanks so much for the help! It works great now.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:39 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.