adrienne_r30
Registered User.
- Local time
- Today, 03:13
- Joined
- Jan 20, 2015
- Messages
- 48
I have a 'main' table with a Project_Number that links all the data in my db together. I have another table that uses that Project_Number as a lookup field to connect that tables data to the main data. I created a 'main' form that has the ability to enter data for the 'main' table. I want to be able to press a button and have the second tables form pop up and add that that specific Project_Number. I added the button and went through the wizard process. I then added the linking info through the builder. It works fine if there is already data entered for the project_number in that specific field. but if the field is empty, the popup window doesn't recognize a project_number and doesn't add it to that record. below is what I am using. The project_number in the 'main' table is text and the Project_Number in the 2nd table in a number since it is a lookup field.
Private Sub CongressionalDistrictCmd_Click()
On Error GoTo Err_CongressionalDistrictCmd_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "sbfrm_Congressional_District"
stLinkCriteria = "[Project_Number]='" & Me.[Project_Number] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CongressionalDistrictCmd_Click:
Exit Sub
Err_CongressionalDistrictCmd_Click:
MsgBox Err.Description
Resume Exit_CongressionalDistrictCmd_Click
End Sub
I'm am getting really frustrated, please HELP!!
Thanks
Private Sub CongressionalDistrictCmd_Click()
On Error GoTo Err_CongressionalDistrictCmd_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "sbfrm_Congressional_District"
stLinkCriteria = "[Project_Number]='" & Me.[Project_Number] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CongressionalDistrictCmd_Click:
Exit Sub
Err_CongressionalDistrictCmd_Click:
MsgBox Err.Description
Resume Exit_CongressionalDistrictCmd_Click
End Sub
I'm am getting really frustrated, please HELP!!
Thanks