|
-
Nov 2nd, 2000, 09:04 AM
#1
I have two forms, I declare a variable as public in the general decleration. In one form I give that variable a value, in the second form I have a select statment using that variable, but it doesn't hold the value. EX: Public phase as string......phase="PRI"...."Select unit from table where ph=phase"
-
Nov 2nd, 2000, 09:06 AM
#2
_______
<?>
Public in a form pertains to all within that form.
Public in a .bas module is across all forms.
Or
Public in a form like this.
Form2.text1 = form1.myVariable
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 2nd, 2000, 09:20 AM
#3
I did put my public statement in the .bas module. In my second form I have something like(phhold=form1.myvar) that works, when I debug the value is there. But on my select statement it doesn't. I got an error messageinvalid column name. If I hard code it in my select statement it works. Maybe my syntex is off, could someone show me how they would write the select statment using the variable in the where clause...THANX
-
Nov 2nd, 2000, 09:29 AM
#4
_______
<?>
easiest if you post your code so one can see what is happening.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 2nd, 2000, 09:42 AM
#5
Your sql statement needs to look somthing like this:
"Select unit from table where ph=" & phase
If phase is a string, do this:
"Select unit from table where ph='" & phase & "'"
Hope it works...
-
Nov 2nd, 2000, 09:43 AM
#6
Module (module.bas)
(general) (declarations)
Public phasehold as string
***************************
FrmMain
(mnuprimary) (click)
phasehold="Pri"
********************************
form2
Public Sub Form_Load()
Dim phhold As String
Dim sphase As String
Dim ssql As String
phhold = phasehold (phhold does show "pri" as its value)
Adodc1.Refresh
ssql = "select unit from units where units.phase = phhold"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = ssql
Adodc1.Refresh
Dim texttotal As Double
End Sub
-
Nov 2nd, 2000, 10:01 AM
#7
DeepestDish
Thanks that was it, I didn't have the right syntex for the variable in the statement.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|