-
Trying to take values from 1 form to another
I am having problems taking values from 1 form to another. I have used this exact code before and never had any problems. However, it seems that it is not working for this particular form and I need some help figuring out why.
I have an IF clause within my source form. At the moment, this is simply choosing whether the destination form opens to a current record or a new record. When it opens to a new record I want to take values from my combo boxes into the destination form so that this data will then be used in the new record.
This is the simple code:
Private Sub cmdEnterResults_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_monitoring_responses"
If (Nz(DLookup("URN", "tblSrvRspns", "URN = " & Me!cboURN), 0) = 0) Then
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Forms!frm_monitoring_search.Controls!cboURN = Forms!frm_monitoring_responses.Controls!cURN
Forms!frm_monitoring_search.Controls!cboSrvID = Forms!frm_monitoring_responses.Controls!cSrvID
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End Sub
When it opens to a new record it is doing so with 0 and 0 in the cURN and cSrvID fields. Is there any reason why it would not enter these details into the destination form.
FYI, cURN and cSrvID are both text boxes bound to the record. It is however possible to enter values manually into these boxes so I don't know why it will not bring the values in from the source form. Any ideas?
-
The syntax for those equates is:
Destination = Source
I believe you have it backwards for what you want to accomplish.
-
RG,
I've had to edit my reply. You are absolutely right. Sorry, it took me a little bit of time to actually catch on to the fact that they were in reverse. Apologies, and thanks!!!
-
Glad to hear you got it sorted.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules