A
Angi
I have a form that displays a list of quotes and invoices from a
company. I'm trying to set the record source of my form through code,
so I can use the same form. I thought it would consist of a simple sql
statement that would match the fields with the controls, but it's not
working. I've set the control sources for the controls the same as the
sql stmt. I've tried the form_load, form_current and form_open events.
If I copy and paste this into the forms record source, it works fine
(after del the _& " of course). Can someone please tell me what I need
to do??? TIA!
Here's my first sql statment:
Private Sub Form_Load()
Dim QuoteSql As String
QuoteSql = "SELECT QuoteMain.QuoteID AS DocNo, QuoteMain.CoID AS
CoCOID, QuoteMain.OrderDate AS OrderDate, QuoteMain.FreightAmt AS
FreightAmt, DSum('ExtPrice','quotedetails','quoteid = ' &
[DocNo])+[freightamt] AS OrderTotal " _
& "FROM QuoteMain ORDER BY QuoteMain.QuoteID;"
CurrentDb.Execute QuoteSql
End Sub
company. I'm trying to set the record source of my form through code,
so I can use the same form. I thought it would consist of a simple sql
statement that would match the fields with the controls, but it's not
working. I've set the control sources for the controls the same as the
sql stmt. I've tried the form_load, form_current and form_open events.
If I copy and paste this into the forms record source, it works fine
(after del the _& " of course). Can someone please tell me what I need
to do??? TIA!
Here's my first sql statment:
Private Sub Form_Load()
Dim QuoteSql As String
QuoteSql = "SELECT QuoteMain.QuoteID AS DocNo, QuoteMain.CoID AS
CoCOID, QuoteMain.OrderDate AS OrderDate, QuoteMain.FreightAmt AS
FreightAmt, DSum('ExtPrice','quotedetails','quoteid = ' &
[DocNo])+[freightamt] AS OrderTotal " _
& "FROM QuoteMain ORDER BY QuoteMain.QuoteID;"
CurrentDb.Execute QuoteSql
End Sub