BlueJacket
Registered User.
- Local time
- Today, 07:32
- Joined
- Jan 11, 2017
- Messages
- 92
I realize this may not be the best way to go about this, but here is my situation...
I have a Client Information form with a combo box for the client name, as well as other generic information text fields. If I want to add a new client, it's my understanding that I can't type in a new client directly into the combo box (since it has two columns), but I have to add in the client name to the table first.
So I created a New Client button that opens a New Client popup form and closes the Client Information form. This part works fine.
The New Client form only asks for the client name with an "OK" button. It also has a "txtID" text field that is not visible. The button has the following code:
But when I click on the "OK" button after entering in a new client name, I get an "Enter Parameter Value" box asking me for the ID value. The debugger highlights " DoCmd.OpenForm stDocName, , , stNewRecord" but I don't see what's wrong. When I hover my mouse over the variables, it has the correct new value for the ID field.
Any input on why this is happening? Am I going about this the wrong way?
I have a Client Information form with a combo box for the client name, as well as other generic information text fields. If I want to add a new client, it's my understanding that I can't type in a new client directly into the combo box (since it has two columns), but I have to add in the client name to the table first.
So I created a New Client button that opens a New Client popup form and closes the Client Information form. This part works fine.
The New Client form only asks for the client name with an "OK" button. It also has a "txtID" text field that is not visible. The button has the following code:
Code:
Private Sub butOK_Click()
If Me.Dirty Then
Me.Dirty = False
End If
Dim stDocName As String
Dim stNewRecord As String
stDocName = "frmClientInfo"
stNewRecord = "[ID] = " & Me![txtID]
DoCmd.OpenForm stDocName, , , stNewRecord
DoCmd.Close acForm, Me.Name
End Sub
But when I click on the "OK" button after entering in a new client name, I get an "Enter Parameter Value" box asking me for the ID value. The debugger highlights " DoCmd.OpenForm stDocName, , , stNewRecord" but I don't see what's wrong. When I hover my mouse over the variables, it has the correct new value for the ID field.
Any input on why this is happening? Am I going about this the wrong way?