Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 19th, 2004, 02:30 PM
Authorized User
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada.
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to lguzman
Default Displaying text depending on the value of a field

I got 3 tables.

Table(A) holds a unique identifier and a description field. I would like to display the description field in a form.

However this is depending on the information held on another table(B). If the information in table(B) is null, I would like to display the information found on a third table(C).

[u]Here is the scenario.</u>
My first table(A) holds the names of companies and their unique identifiers. The second table holds information of divisions within an organization. The third table(C) holds information on the organizations. I need to know who I should charge, the head office (organization) or the divisions themselves. So if no info exists on the second table(B) -division- then I want to charge by default the Organization table(C) or any third party that has agreed to pay for this organization.

So what I am looking to do is, find who (table(B) or table(C)) and then withdraw the description from table(A) and display it.

I have come up with the following:

Public Function GetAccountingBillTo()
Dim TempNum As Integer
Dim TempName As String

If AccountingBilltoC = "" Then
   TempNum = DLookup("[AccountingBilltoO]", "Organizations", "[Name] =" & Customers!OrganizationName)
   If TempNum <> "" Then
      TempName = DLookup("[sName]", "TblAccountingBillToDropDownInfo", "[tempnum]=" & Organizations!AccountingBilltoO)
   Else
       TempName=" "
   End If
Else
   TempName = DLookup("[sName]", "TblAccountingBillToDropDownInfo", "[tempnum]=" & Customers!AccountingBilltoC)
End If
Text179 = TempName
End Function


This however gets me a Run-Time error '424'. Object required.


Help!

[u]Thanks.</u>

[LGuzman]
__________________
[LGuzman]
Reply With Quote
  #2 (permalink)  
Old May 30th, 2004, 06:14 PM
Authorized User
 
Join Date: Oct 2003
Location: Toronto, Ontario, Canada.
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello LGuzman,
First of all, your function must have a result, you have Text179 = TempName, it should be
GetAccountingBillTo = TempName, & I believe your function decleration should be Public Function GetAccountingBillTo() as String.
Then on the form, fired by whatever event you choose, Text179 = GetAccountingBillTo.
I'm thinking also, that you shouild be checking for Null , not empty strings.
If IsNull(AccountingBilltoC) Then.... or
If Not IsNull(AccountingBilltoC) Then....
Good Luck!

Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Text(Sql Server Text Field) to Image(JPG) srinivas72 ADO.NET 2 February 13th, 2009 05:31 PM
Displaying Text using CSS austinf CSS Cascading Style Sheets 3 October 11th, 2007 02:58 PM
Memo field not displaying meichmann SQL Server ASP 3 August 31st, 2006 11:36 AM
Displaying OLE object field in a form Rick Neifeld Access VBA 0 December 24th, 2003 01:16 PM
Displaying field selection meiyeen JSP Basics 0 July 13th, 2003 11:22 PM



All times are GMT -4. The time now is 02:34 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.