Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command button to open subfrom.

Status
Not open for further replies.

TeqGirl

MIS
Apr 14, 2008
1
US
Here is what I have....
I have a main from called Equipment it has 2 subforms one for the IP Data and
one for Budget Data.
When I click the command button it opens the sub form however it does not seem to copy the IDTag to the subfrom EuqipmentID area so that everything is linked together right.

My Tables are:
tblEquipment
IDTag - Txt & PK
EquipmentType
Location
LocationDesc
Mfg
Model
SerialNum
PONum
Contract
WarType
WarExpDate
Surplus
SurplusDate
InventoryDate
Notes

tblBudget
ID - Auto # & PK
EquipmentID - Txt
BdgYear
Expenditure
Purpose

tblIPData
ID -Auto # & PK
EquipmentID - txt
MAC
IP
SN
GW
PDNS
SDNS
Wireless

Relationships are:
tblEquipment to tblBudget on IDTag = EquipmentID One-To-Many all from tblEquipment and only those from tblBudget where fields are equal.
tblEquipment to tblIPData on IDTag = EquipmentID One-To-Many all from tblEquipment and only those from tblIPData where fields are equal.

Here is my code for the command buttons:
IPData
Private Sub IPData_Click()
On Error GoTo Err_IPData_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmIPData"

stLinkCriteria = "[EquipmentID]=""" & Me![IDTag] & """"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
Forms!frmIPData!equipmentid.DefaultValue = Me.IDTag
DoCmd.MoveSize 3 * 1440, 2 * 1440, 9.5 * 1440, 5 * 1440

Exit_IPData_Click:
Exit Sub

Err_IPData_Click:
MsgBox Err.Description
Resume Exit_IPData_Click
End Sub

Budget
Private Sub Budget_Click()
On Error GoTo Err_Budget_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmBudget"

stLinkCriteria = "[EquipmentID]=" & Me![IDTag]
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
Forms!frmbudget!equipmentid.DefaultValue = Me.IDTag
DoCmd.MoveSize 3 * 1440, 2 * 1440, 5.4 * 1440, 7 * 1440

Exit_Budget_Click:
Exit Sub

Err_Budget_Click:
MsgBox Err.Description
Resume Exit_Budget_Click


End Sub
 
Hi TeqGirl,
I don't know the answer to your question, but you might get more responses after you check out the following links.
Good Luck.

FAQ219-2884:
FAQ181-2886:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top