PC Review


Reply
Thread Tools Rate Thread

Help with code

 
 
short
Guest
Posts: n/a
 
      8th Jul 2008
I'm creating a database that when the user selects the item in the combo box
and clicks the command button the information about that certain item is
displayed in their tables...

This is my code for where I'm have troubles:

ElseIf cbChangeView.value = "Application" Then
'///////////////////////////////////////////
'SetDefaults() = populates the rest of the table
'Table# = Name of the displayed table
Call SetDefaults(1, "Application", True)
Table1 = "Table.Application"
If IsNull(Me.cbName.value) Then
Me.cbName.value = ""
End If

'Sets the query statements for all of the tables used
Query1 = "SELECT * FROM Application WHERE Application.[Name]='" +
cbName.value + "';"
Query2 = "SELECT JVM.* FROM JVM, ApplicationJVM, Application WHERE " _
& "Application.[ID] = ApplicationJVM.[AppID] AND
ApplicationJVM.[JVMID]" _
& "= JVM.[ID] AND Application.[Name]='" + cbName.value + "';"
Query3 = "SELECT * FROM ApplicationJVM,Application WHERE Application.[ID]" _
& "= ApplicationJVM.[AppID] AND Application.[Name]='" +
cbName.value + "';"
Query4 = "SELECT Cluster.* FROM Cluster INNER JOIN (Application INNER JOIN
ApplicationCluster ON Application.ID = ApplicationCluster.AppID) ON
Cluster.ID = ApplicationCluster.CID WHERE " _
& " (((Application.ID)=[Application].[ID])) AND Application.[Name] = '" +
cbName.value + "';"

Query4 is what is not working, nothing is properly displayed. For query4
it's connected to the tables cluster, application, and applicationcluster.
Applicationcluster holds the primary keys for both the cluster and
application and connects them if that makes sense.
 
Reply With Quote
 
 
 
 
short
Guest
Posts: n/a
 
      8th Jul 2008
sorry this is what query4 says:

Query4 = "SELECT Cluster.* FROM Cluster INNER JOIN (Application INNER JOIN
ApplicationCluster ON Application.ID = ApplicationCluster.AppID) ON
Cluster.ID = ApplicationCluster.CID WHERE " _
& " (((Application.ID)=[Application].[ID])) AND Application.[Name] = '" +
cbName.value + "';"

"short" wrote:

> I'm creating a database that when the user selects the item in the combo box
> and clicks the command button the information about that certain item is
> displayed in their tables...
>
> This is my code for where I'm have troubles:
>
> ElseIf cbChangeView.value = "Application" Then
> '///////////////////////////////////////////
> 'SetDefaults() = populates the rest of the table
> 'Table# = Name of the displayed table
> Call SetDefaults(1, "Application", True)
> Table1 = "Table.Application"
> If IsNull(Me.cbName.value) Then
> Me.cbName.value = ""
> End If
>
> 'Sets the query statements for all of the tables used
> Query1 = "SELECT * FROM Application WHERE Application.[Name]='" +
> cbName.value + "';"
> Query2 = "SELECT JVM.* FROM JVM, ApplicationJVM, Application WHERE " _
> & "Application.[ID] = ApplicationJVM.[AppID] AND
> ApplicationJVM.[JVMID]" _
> & "= JVM.[ID] AND Application.[Name]='" + cbName.value + "';"
> Query3 = "SELECT * FROM ApplicationJVM,Application WHERE Application.[ID]" _
> & "= ApplicationJVM.[AppID] AND Application.[Name]='" +
> cbName.value + "';"
> Query4 = "SELECT Cluster.* FROM Cluster INNER JOIN (Application INNER JOIN
> ApplicationCluster ON Application.ID = ApplicationCluster.AppID) ON
> Cluster.ID = ApplicationCluster.CID WHERE " _
> & " (((Application.ID)=[Application].[ID])) AND Application.[Name] = '" +
> cbName.value + "';"
>
> Query4 is what is not working, nothing is properly displayed. For query4
> it's connected to the tables cluster, application, and applicationcluster.
> Applicationcluster holds the primary keys for both the cluster and
> application and connects them if that makes sense.

 
Reply With Quote
 
Paolo
Guest
Posts: n/a
 
      9th Jul 2008
Hi short,
I don't understand the meaning of this part of query4

WHERE " _
& " (((Application.ID)=[Application].[ID]))

is this correct?

Paolo

"short" wrote:

> sorry this is what query4 says:
>
> Query4 = "SELECT Cluster.* FROM Cluster INNER JOIN (Application INNER JOIN
> ApplicationCluster ON Application.ID = ApplicationCluster.AppID) ON
> Cluster.ID = ApplicationCluster.CID WHERE " _
> & " (((Application.ID)=[Application].[ID])) AND Application.[Name] = '" +
> cbName.value + "';"
>
> "short" wrote:
>
> > I'm creating a database that when the user selects the item in the combo box
> > and clicks the command button the information about that certain item is
> > displayed in their tables...
> >
> > This is my code for where I'm have troubles:
> >
> > ElseIf cbChangeView.value = "Application" Then
> > '///////////////////////////////////////////
> > 'SetDefaults() = populates the rest of the table
> > 'Table# = Name of the displayed table
> > Call SetDefaults(1, "Application", True)
> > Table1 = "Table.Application"
> > If IsNull(Me.cbName.value) Then
> > Me.cbName.value = ""
> > End If
> >
> > 'Sets the query statements for all of the tables used
> > Query1 = "SELECT * FROM Application WHERE Application.[Name]='" +
> > cbName.value + "';"
> > Query2 = "SELECT JVM.* FROM JVM, ApplicationJVM, Application WHERE " _
> > & "Application.[ID] = ApplicationJVM.[AppID] AND
> > ApplicationJVM.[JVMID]" _
> > & "= JVM.[ID] AND Application.[Name]='" + cbName.value + "';"
> > Query3 = "SELECT * FROM ApplicationJVM,Application WHERE Application.[ID]" _
> > & "= ApplicationJVM.[AppID] AND Application.[Name]='" +
> > cbName.value + "';"
> > Query4 = "SELECT Cluster.* FROM Cluster INNER JOIN (Application INNER JOIN
> > ApplicationCluster ON Application.ID = ApplicationCluster.AppID) ON
> > Cluster.ID = ApplicationCluster.CID WHERE " _
> > & " (((Application.ID)=[Application].[ID])) AND Application.[Name] = '" +
> > cbName.value + "';"
> >
> > Query4 is what is not working, nothing is properly displayed. For query4
> > it's connected to the tables cluster, application, and applicationcluster.
> > Applicationcluster holds the primary keys for both the cluster and
> > application and connects them if that makes sense.

 
Reply With Quote
 
short
Guest
Posts: n/a
 
      9th Jul 2008
I have now chaged it to:
Query4 = "SELECT Cluster.* FROM Cluster, ApplicationCluster, Application
WHERE Application.[ID] = ApplicationCluster.[AppID] AND
ApplicationCluster.[CID]= Cluster.[ID] AND Application.[Name]= '" +
cbName.value + "';"

it's still not working and I'm thinking it might have to do with the add
form I have..

which is this:

'/////////////////////////////////////////////////////////////////
ElseIf Forms!UpdateInformation.Form!cbChangeView.value = "Application" Then
'/////////////////////////////////////////////////////////////////
'this is the name of the server
name = Forms!UpdateInformation.Form!cbName.value

Set db = CurrentDb

'this gets the server table ID
strSQL = "SELECT * FROM Application WHERE " + "Application.[Name]='" +
name + "';"
Set rs2 = db.OpenRecordset(strSQL)
'This is the server ID
If rs2.RecordCount > 0 Then
intResult = rs2("ID")
Else
intResult = 0
End If
'this gets everything in the table and sets them to a record set
Set cn = CurrentProject.Connection
Set rs = cn.Execute("Select * From " + Me.lbOptionTitle.Caption)

'sets everything on the form to blank
Call CleanUpItems

'populates the form with the values
For i = 0 To rs.Fields.Count - 1 Step 1
'gets the field name
name = rs.Fields(i).name + ""
'makes the field name visible
Call FillInItems(i, name, True)


If i < 4 Then
'check to see if there should be a lookup button
Call FindIDs(name, i)
'search "name" == "_ID_Table"
' if a name matches the id table then
' hide the text box, and make the button visible
End If

Next i



'Searches for a foreign key and auto populates it
Call FKpop("Application.ID", intResult)
Call FKpop("CID", intResult)



"Paolo" wrote:

> Hi short,
> I don't understand the meaning of this part of query4
>
> WHERE " _
> & " (((Application.ID)=[Application].[ID]))
>
> is this correct?
>
> Paolo
>
> "short" wrote:
>
> > sorry this is what query4 says:
> >
> > Query4 = "SELECT Cluster.* FROM Cluster INNER JOIN (Application INNER JOIN
> > ApplicationCluster ON Application.ID = ApplicationCluster.AppID) ON
> > Cluster.ID = ApplicationCluster.CID WHERE " _
> > & " (((Application.ID)=[Application].[ID])) AND Application.[Name] = '" +
> > cbName.value + "';"
> >
> > "short" wrote:
> >
> > > I'm creating a database that when the user selects the item in the combo box
> > > and clicks the command button the information about that certain item is
> > > displayed in their tables...
> > >
> > > This is my code for where I'm have troubles:
> > >
> > > ElseIf cbChangeView.value = "Application" Then
> > > '///////////////////////////////////////////
> > > 'SetDefaults() = populates the rest of the table
> > > 'Table# = Name of the displayed table
> > > Call SetDefaults(1, "Application", True)
> > > Table1 = "Table.Application"
> > > If IsNull(Me.cbName.value) Then
> > > Me.cbName.value = ""
> > > End If
> > >
> > > 'Sets the query statements for all of the tables used
> > > Query1 = "SELECT * FROM Application WHERE Application.[Name]='" +
> > > cbName.value + "';"
> > > Query2 = "SELECT JVM.* FROM JVM, ApplicationJVM, Application WHERE " _
> > > & "Application.[ID] = ApplicationJVM.[AppID] AND
> > > ApplicationJVM.[JVMID]" _
> > > & "= JVM.[ID] AND Application.[Name]='" + cbName.value + "';"
> > > Query3 = "SELECT * FROM ApplicationJVM,Application WHERE Application.[ID]" _
> > > & "= ApplicationJVM.[AppID] AND Application.[Name]='" +
> > > cbName.value + "';"
> > > Query4 = "SELECT Cluster.* FROM Cluster INNER JOIN (Application INNER JOIN
> > > ApplicationCluster ON Application.ID = ApplicationCluster.AppID) ON
> > > Cluster.ID = ApplicationCluster.CID WHERE " _
> > > & " (((Application.ID)=[Application].[ID])) AND Application.[Name] = '" +
> > > cbName.value + "';"
> > >
> > > Query4 is what is not working, nothing is properly displayed. For query4
> > > it's connected to the tables cluster, application, and applicationcluster.
> > > Applicationcluster holds the primary keys for both the cluster and
> > > application and connects them if that makes sense.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq to XML--Are there code examples that make Linq as easy as SQL? Or how can I convert ths simple pseudo code into real code? Reece Microsoft C# .NET 4 10th Dec 2008 04:13 AM
ATI Radeon Drivers - Code 43, Code 37 & Code 10 =?Utf-8?B?SmFrZQ==?= Windows Vista Hardware 14 29th Aug 2006 06:50 AM
ATI Display Drivers - Code 43, Code 37, Code 10 Jake Windows Vista Hardware 2 8th Jul 2006 05:00 PM
what is the difference between code inside a <script> tag and code in the code-behind file? keithb Microsoft ASP .NET 1 29th Mar 2006 03:00 AM
[New] Zipoid - ZIP Code, City Name and Area Code Lookup - Zip Code to Zip Code Distance Calculation Mel Freeware 0 22nd Jul 2005 05:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:19 PM.