Subform Control reference problem!!

jkfeagle

Codus Confusious
Local time
Today, 15:34
Joined
Aug 22, 2002
Messages
166
Somebody please help!! I'm trying to set a button up on a form to send an e-mail. The code below in in the On Click property. I keep getting an error message 'Microsoft Access cannot find the field 'l' referred to in your expression'. The line of code that the debugger takes me to is the first strTextMessage line. I don't even see an 'l' in that line! frmTransaction_History and frmFinancial_Tracking are subforms on the main form. I don't have much hair left to pull out. Somebody save what little I have left!

Private Sub cmdSendEmail_Click()
Dim strTextMessage As String
strTextMessage = "Dear " & [frmTransaction_History]![Name] & "," & Chr(13)
strTextMessage = strTextMessage & Chr(13)
strTextMessage = strTextMessage & "Congratulations on winning the " & Me!Title & " Auction" & Chr(13)
strTextMessage = strTextMessage & "Your winning bid amount was $" & Me!FinalBid & " and your shipping will be $" & [frmFinancial_Tracking]![Shipping] & ". strTextMessage = strTextMessage & "Thanks so much for your business and I look forward to hearing from you!" & Chr(13)
strTextMessage = strTextMessage & Chr(13)


DoCmd.SendObject acSendNoObject, , , Me![Transaction_History]!, , , "Ebay Auction " & Me!ItemNumber, strTextMessage, True

:eek: :eek:
 
You have a field called Name, which is a reserved word in Access, change it to something else before you go any further
 
I removed that field reference and now the same error comes up for the next subform control reference. It does not seem to occur for the control references on the main form.
 
OK I figured out part of the problem but I'm not sure where to go from here. The subforms that I refer to are part of a Tab Control. Now I'm really not sure how to refer to it.
 
Have you tried:

me.subformname!textboxname

??

Brad.
 
PROBLEM SOLVED! SORTA

The Tab Control thing really through the proverbial wrench in the works so I just created a hidden subform based on a query that gave me the fields I wanted. Just for everyone's info...according to the Microsoft website (and it works), the correct reference is:

Forms![Main Form]![Subform].Form![control name]

Apparently this is because Access sees a subform as a control and not a form. Hope this helps somebody else!!! Thanks to everyone for your assistance.
 

Users who are viewing this thread

Back
Top Bottom