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  

GetDesignerAddress() works one way but not the other, please help!



 
 
Thread Tools Display Modes
  #1  
Old November 15th, 2006, 05:08 PM posted to microsoft.public.access.modulescoding,microsoft.public.access.formscoding,microsoft.public.access.forms
Gina Whipp
external usenet poster
 
Posts: 3,500
Default GetDesignerAddress() works one way but not the other, please help!

Hello All,

Little problem, if I type:

WhichDesigner = DLookup("pWhichDivision", "tblProjects", "pID = ProjectID")

doesn't work.

But if I type:

WhichDesigner = DLookup("pWhichDivision", "tblProjects", "pID = 1")

works perfectly. The entire code is below. Can one of you kind gents or
ladies help me out?

Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II



Public Function GetDesignerAddress(ProjectID As Long) As String

Dim WhichDesigner As String
WhichDesigner = DLookup("pWhichDivision", "tblProjects", "pID =
ProjectID")

GetDesignerAddress = DLookup("[cpCompanyName]", "tblCompanyProfile",
"[cpCompanyID]='" & WhichDesigner & "'") & Chr(13) & Chr(10) & _
DLookup("[cpAddress]", "tblCompanyProfile",
"[cpCompanyID]='" & WhichDesigner & "'") & Chr(13) & Chr(10) & _
DLookup("[cpAddress2]", "tblCompanyProfile",
"[cpCompanyID]='" & WhichDesigner & "'") & Chr(13) & Chr(10) & _
DLookup("[cpCity]", "tblCompanyProfile",
"[cpCompanyID]='" & WhichDesigner & "'") & ", " & DLookup("[cpState]",
"tblCompanyProfile", "[cpCompanyID]='" & WhichDesigner & "'") & " " &
DLookup("[cpZipCode]", "tblCompanyProfile", "[cpCompanyID]='" &
WhichDesigner & "'") & _
Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Phone
Number: " & DLookup("[cpMainPhoneNumber]", "tblCompanyProfile",
"[cpCompanyID]='" & WhichDesigner & "'") & Chr(13) & Chr(10) & _
"Fax Number: " & DLookup("[cpFaxNumber]",
"tblCompanyProfile", "[cpCompanyID]='" & WhichDesigner & "'")

End Function


  #2  
Old November 15th, 2006, 05:14 PM posted to microsoft.public.access.modulescoding,microsoft.public.access.formscoding,microsoft.public.access.forms
Stefan Hoffmann
external usenet poster
 
Posts: 709
Default GetDesignerAddress() works one way but not the other, pleasehelp!

hi Gina,

Gina Whipp wrote:
Public Function GetDesignerAddress(ProjectID As Long) As String

Dim WhichDesigner As String
WhichDesigner = DLookup("pWhichDivision", "tblProjects", "pID =
ProjectID")

You must build a correct criteria string:

WhichDesigner = DLookup("pWhichDivision", _
"tblProjects", _
"pID = " & ProjectID)

End Function



mfG
-- stefan --
  #3  
Old November 15th, 2006, 05:14 PM posted to microsoft.public.access.modulescoding,microsoft.public.access.formscoding,microsoft.public.access.forms
Gina Whipp
external usenet poster
 
Posts: 3,500
Default GetDesignerAddress() works one way but not the other, please help!

Nevermind, I got it! More coffee needed

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II


"Gina Whipp" wrote in message
...
Hello All,

Little problem, if I type:

WhichDesigner = DLookup("pWhichDivision", "tblProjects", "pID =
ProjectID")

doesn't work.

But if I type:

WhichDesigner = DLookup("pWhichDivision", "tblProjects", "pID = 1")

works perfectly. The entire code is below. Can one of you kind gents or
ladies help me out?

Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II



Public Function GetDesignerAddress(ProjectID As Long) As String

Dim WhichDesigner As String
WhichDesigner = DLookup("pWhichDivision", "tblProjects", "pID =
ProjectID")

GetDesignerAddress = DLookup("[cpCompanyName]", "tblCompanyProfile",
"[cpCompanyID]='" & WhichDesigner & "'") & Chr(13) & Chr(10) & _
DLookup("[cpAddress]", "tblCompanyProfile",
"[cpCompanyID]='" & WhichDesigner & "'") & Chr(13) & Chr(10) & _
DLookup("[cpAddress2]", "tblCompanyProfile",
"[cpCompanyID]='" & WhichDesigner & "'") & Chr(13) & Chr(10) & _
DLookup("[cpCity]", "tblCompanyProfile",
"[cpCompanyID]='" & WhichDesigner & "'") & ", " & DLookup("[cpState]",
"tblCompanyProfile", "[cpCompanyID]='" & WhichDesigner & "'") & " " &
DLookup("[cpZipCode]", "tblCompanyProfile", "[cpCompanyID]='" &
WhichDesigner & "'") & _
Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Phone
Number: " & DLookup("[cpMainPhoneNumber]", "tblCompanyProfile",
"[cpCompanyID]='" & WhichDesigner & "'") & Chr(13) & Chr(10) & _
"Fax Number: " & DLookup("[cpFaxNumber]",
"tblCompanyProfile", "[cpCompanyID]='" & WhichDesigner & "'")

End Function



 




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 12:37 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.