A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Tab Control and Dlookup



 
 
Thread Tools Display Modes
  #1  
Old February 18th, 2010, 03:03 PM posted to microsoft.public.access.forms
disneygoof via AccessMonster.com
external usenet poster
 
Posts: 57
Default 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  
Old February 18th, 2010, 03:15 PM posted to microsoft.public.access.forms
disneygoof via AccessMonster.com
external usenet poster
 
Posts: 57
Default 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  
Old February 18th, 2010, 05:48 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default 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  
Old February 18th, 2010, 06:06 PM posted to microsoft.public.access.forms
disneygoof via AccessMonster.com
external usenet poster
 
Posts: 57
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:34 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.