If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Tab Control and Dlookup
Greetings All,
I have a form with a tab control on it with multiple tabs (Project, Contractor, Architect, Engineer). Looking at Contractor, I have a dropdown that pulls from a contractor list table and returns the name of the contractor to the screen, but the ContractorID is stored in the table...works fine. I have added 2 textboxes (unbound) to the contractors tab. Then I added call procedure the performs two Dlookup's after I update the name in the contractor dropdown to put the address and city, state, zip. I get NO error, but I also get no data. I also added the call procedure to the click procedure on the contractor tab...nothing. I use this same methodoloy in a differnet form, but NOT on a tab control...what am I doing wrong? I have debugged to ensure the variables in the call procedure are getting the data and they are...I just can't seem to get them to display in the TAB control. If I move the textboxes from the tab control and place them in the main form, they work fine... Textboxs on Tab Control are called ContAddress and ContCSZ, both unbound Call Procedure code Dim ContAddress As String Dim cc As String Dim cs As String Dim cz As String Dim ContCSZ As String ContAddress = Nz(DLookup("ContractorAddress", "tblContractorInfo", "ContractorID =" & Me.ContractorID), "") cc = Nz(DLookup("ContractorCity", "tblContractorInfo", "ContractorID =" & ContractorID), "") cs = Nz(DLookup("ContractorState", "tblContractorInfo", "ContractorID =" & ContractorID), "") cz = Nz(DLookup("ContractorZipcode", "tblContractorInfo", "ContractorID =" & ContractorID), "") ContCSZ = cc & ", " & CS & " " & cz -- David (Disneygoof) Message posted via http://www.accessmonster.com |
#2
|
|||
|
|||
Tab Control and Dlookup
I feel soooooooo stupid. I was forgetting to put ME. in front of the
variable name...DUH! disneygoof wrote: Greetings All, I have a form with a tab control on it with multiple tabs (Project, Contractor, Architect, Engineer). Looking at Contractor, I have a dropdown that pulls from a contractor list table and returns the name of the contractor to the screen, but the ContractorID is stored in the table...works fine. I have added 2 textboxes (unbound) to the contractors tab. Then I added call procedure the performs two Dlookup's after I update the name in the contractor dropdown to put the address and city, state, zip. I get NO error, but I also get no data. I also added the call procedure to the click procedure on the contractor tab...nothing. I use this same methodoloy in a differnet form, but NOT on a tab control...what am I doing wrong? I have debugged to ensure the variables in the call procedure are getting the data and they are...I just can't seem to get them to display in the TAB control. If I move the textboxes from the tab control and place them in the main form, they work fine... Textboxs on Tab Control are called ContAddress and ContCSZ, both unbound Call Procedure code Dim ContAddress As String Dim cc As String Dim cs As String Dim cz As String Dim ContCSZ As String ContAddress = Nz(DLookup("ContractorAddress", "tblContractorInfo", "ContractorID =" & Me.ContractorID), "") cc = Nz(DLookup("ContractorCity", "tblContractorInfo", "ContractorID =" & ContractorID), "") cs = Nz(DLookup("ContractorState", "tblContractorInfo", "ContractorID =" & ContractorID), "") cz = Nz(DLookup("ContractorZipcode", "tblContractorInfo", "ContractorID =" & ContractorID), "") ContCSZ = cc & ", " & CS & " " & cz -- David (Disneygoof) Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
Tab Control and Dlookup
FWIW, there's actually a much easier way.
Set the RowSource of the combo box to a query that returns all of the different fields. If, for example, the fields in the RowSource are ContractID, ContractName, ContractorAddress, ContractorCity, ContractorState and ContractorZipcode (in that order), you can use Me.ContAddress = Me.ContractorID.Column(2) Me.ContCSZ = Me.ContractorID.Column(3) & ", " & _ Me.ContractorID.Column(4) & " " & Me.ContractorID.Column(5) Note that the Column collection starts numbering at 0, so the content of the 3rd column is referred to as Column(2). -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "disneygoof via AccessMonster.com" u32262@uwe wrote in message news:a3d2770b1072f@uwe... I feel soooooooo stupid. I was forgetting to put ME. in front of the variable name...DUH! disneygoof wrote: Greetings All, I have a form with a tab control on it with multiple tabs (Project, Contractor, Architect, Engineer). Looking at Contractor, I have a dropdown that pulls from a contractor list table and returns the name of the contractor to the screen, but the ContractorID is stored in the table...works fine. I have added 2 textboxes (unbound) to the contractors tab. Then I added call procedure the performs two Dlookup's after I update the name in the contractor dropdown to put the address and city, state, zip. I get NO error, but I also get no data. I also added the call procedure to the click procedure on the contractor tab...nothing. I use this same methodoloy in a differnet form, but NOT on a tab control...what am I doing wrong? I have debugged to ensure the variables in the call procedure are getting the data and they are...I just can't seem to get them to display in the TAB control. If I move the textboxes from the tab control and place them in the main form, they work fine... Textboxs on Tab Control are called ContAddress and ContCSZ, both unbound Call Procedure code Dim ContAddress As String Dim cc As String Dim cs As String Dim cz As String Dim ContCSZ As String ContAddress = Nz(DLookup("ContractorAddress", "tblContractorInfo", "ContractorID =" & Me.ContractorID), "") cc = Nz(DLookup("ContractorCity", "tblContractorInfo", "ContractorID =" & ContractorID), "") cs = Nz(DLookup("ContractorState", "tblContractorInfo", "ContractorID =" & ContractorID), "") cz = Nz(DLookup("ContractorZipcode", "tblContractorInfo", "ContractorID =" & ContractorID), "") ContCSZ = cc & ", " & CS & " " & cz -- David (Disneygoof) Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
Tab Control and Dlookup
Nice...I will have to improve my code, thanks much!
Douglas J. Steele wrote: FWIW, there's actually a much easier way. Set the RowSource of the combo box to a query that returns all of the different fields. If, for example, the fields in the RowSource are ContractID, ContractName, ContractorAddress, ContractorCity, ContractorState and ContractorZipcode (in that order), you can use Me.ContAddress = Me.ContractorID.Column(2) Me.ContCSZ = Me.ContractorID.Column(3) & ", " & _ Me.ContractorID.Column(4) & " " & Me.ContractorID.Column(5) Note that the Column collection starts numbering at 0, so the content of the 3rd column is referred to as Column(2). I feel soooooooo stupid. I was forgetting to put ME. in front of the variable name...DUH! [quoted text clipped - 45 lines] =" & ContractorID), "") ContCSZ = cc & ", " & CS & " " & cz -- David (Disneygoof) Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201002/1 |
Thread Tools | |
Display Modes | |
|
|