scadaman29325
Jul 7 2009, 12:45 PM
On my frmWorkOrders I have a cboWoDiv that picks from tblDivision and displays the Div Field.
I also want a txtbx to display another field (DivEmail) from the same tblDiv.
i.e cboWoDiv selects the div, and then the txtDivEmail populates from that selection.
TIA,
Phil
PS, I did this by pulling from a 'related table' in 'add existing fields' and it works fine, but it screwed up the frmWo
Record Source, which screwed up the sort I had when the record source was just tWorkorders
FYI, This is what happened to the record source:
SELECT tWorkOrders.*, tDivisions.DivEmail
FROM tDivisions INNER JOIN tWorkOrders ON (tDivisions.DivID = tWorkOrders.WoDiv);
Bob_L
Jul 7 2009, 12:49 PM
In the after update event of the combo put:
Me.txtDivEmail = Me.cboWoDiv.Column(1)
fkegley
Jul 7 2009, 12:57 PM
You should not be messing with the record source of the form. Instead add the field you want to display to the combo box row source. Then use Bob's code to do the work.
Edited by: fkegley on Tue Jul 7 13:57:54 EDT 2009.
scadaman29325
Jul 7 2009, 02:16 PM
QUOTE
You should not be messing with the record source of the form. Instead add the field you want to display to the combo box row source. Then use Bob's code to do the work.
Edited by: fkegley on Tue Jul 7 13:57:54 EDT 2009.
Yes, I'm learning.
Thanks to all for the help!
Phil
scadaman29325
Jul 7 2009, 02:31 PM
QUOTE
In the after update event of the combo put:
Me.txtDivEmail = Me.cboWoDiv.Column(1)
does this mean that txtDivEmail is unbound and the above determines the contents/row source on the fly?
Just trying to learn a little at a time!
Thanks
Phil
EDIT: oops no row source for txt boxes...
Edited by: scadaman29325 on Tue Jul 7 15:33:35 EDT 2009.
mike60smart
Jul 7 2009, 02:41 PM
Hi Phil
Seeing as Frank in not around at the moment I will jump in
Yes - when you choose an item from the Div combobox it will display the Division and the Email
So the After Update of your selection will look at the Columns andf fill in the relevant Email address into the Unbound Textbox
Hope this helps
Mike
fkegley
Jul 7 2009, 02:42 PM
Yes, Phil, that is what is happening. It just puts a value into an otherwise unbound text box.
scadaman29325
Jul 7 2009, 02:44 PM
QUOTE
In the after update event of the combo put:
Me.txtDivEmail = Me.cboWoDiv.Column(1)
Did not work.
getting vba error
Do these lines of code should not interfer with each other, both are in afterupdate:
'cascade cbo's
Me.cboWoCat.RowSource = "SELECT Cat FROM" & _
" tcategories WHERE CatDiv = " & Me.cboWoDiv & _
" ORDER BY Cat"
'fill in txtWoDiv
Me.txtDivEmail = Me.cboWoDiv.Column(1) (highlighted yellow)
Thanks,
Phil
scadaman29325
Jul 7 2009, 02:50 PM
DivEmail is in the control source of txtDivEmail
Edited by: scadaman29325 on Tue Jul 7 15:50:48 EDT 2009.
scadaman29325
Jul 7 2009, 02:56 PM
Ahhh!
deleted the DivEmail from control source, makes txtbox display unbound in design view, now it cna be updated by your code.
Also changed col(1) to col (2).
Works GREAT.
Thanks,
Phil
scadaman29325
Jul 7 2009, 03:24 PM
Almost had an aneurism!
Deleted the last 10 test records from live db tbl and went to navigate the form... had 'deleted' in all controls of those supposedly deleted records. I was expecting it to just skip those deleted record numbers.
Went to the BE, they were gone (good), went back to FE and now they were gone (good).
btw, I did hit 'refresh all' somewhere in my frantic episode, maybe that helped.
I think I'll change my favorite quote to 'learning the hard way',
either that or 'getting my butt kicked with each line of code I type'...
Thanks for y'all's help!
Phil
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.