transfer text values to another form

mazza

Registered User.
Local time
Today, 00:02
Joined
Feb 9, 2005
Messages
101
I have a main data entry form (frmpartquote). From this form I would like to open a new form (products) to create a sub set of records.

When I open the new form to add products to a main quote I would like to transfer the quotenumber on the quote form to the quotenumberfield in the products form.

I use the following code in the on open event in the product

Private Sub Form_Open(Cancel As Integer)
If IsOpen("frmpartquote") Then
partquotenumber.DefaultValue = Forms!FrmPartQuote!partquoteid
End If
End Sub


Now this works fine as long as the field is a number.

However I would like to use tartquotenumber as a text field

any ideas how I will do that....

thanks

:confused:
 
thanks
looked at some of them but I am still none the wiser and need some more help.

On the partquoteform I have a button to open the partsform with the following onclick event and open args

Private Sub Command28_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FrmPartQuoteSub"

stLinkCriteria = "[PartQuoteNumber]=" & Me![partquotenumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub

If there are already parts attached to the main quote the form will show all in a continous view.
If no parts have been added yet the form will just show a new record with the onopen event will populate the quotenumber to the new record on the frmpartquotesub. the problem is that I am only able to transfer a numeric value but not a text value. (when I change the field type in the tables to text I simply get #name? not the actual quote ref number.
If I change it to numeric then it works fine....


Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
If IsOpen("frmpartquote") Then
partquotenumber.DefaultValue = Forms!FrmPartQuote!partquoteid
End If
End Sub


Where do I go wrong?
 
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
If IsOpen("frmpartquote") Then
partquotenumber.DefaultValue = Forms!FrmPartQuote!partquoteid
End If
End Sub

Try This:

Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
Const cQuote = """"
Me.partquotenumber.DefaultValue = cQuote & Forms!FrmPartQuote!partquoteid & cQuote
 

Users who are viewing this thread

Back
Top Bottom