Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

openargs continuous form help.. 2

Status
Not open for further replies.

Dre313

Technical User
Jun 4, 2003
219
US
Hi, I tired posting this in the access forms section.. but got no response.. maybe I posted in the wrong forum anyways.. heres my problem..


I keep on getting an error ... compile error : invalid qualifier... on my second form..

my 2nd form is called.. "frmAddInspec" with 3 text fields "Text1,Text2.Text3" all string

My first form.. the values that I want over on my second form are..
"Project,Area,Reference"

My code behind the cmd button of first form is..



code:--------------------------------------------------------------------------------

Private Sub Command11_Click()
DoCmd.OpenForm "frmAddInspec", OpenArgs:=Project & ";" & Area & ";" & Reference

End Sub
--------------------------------------------------------------------------------


My code for my second form.. in the open event handler is...


code:--------------------------------------------------------------------------------

Private Sub Form_Open(Cancel As Integer)
Dim Project As String
Dim Area As String
Dim Reference As String
Dim Iloc1 As Integer
Dim iLoc2 As String
Dim strArgs As String
Dim Text1, Text2, Text3 As String

strArgs = Me.OpenArgs & ""

If Len(strArgs) > 0 Then
Iloc1 = InStr(strArgs, ";")
If Iloc1 > 0 Then
Project = Left$(strArgs, Iloc1 - 1)
Text1.Text = Project
iLoc2 = InStr(Iloc1 + 1, strArgs, ";")
Area = Mid$(strArgs, Iloc1 + 1, iLoc2 - Iloc1 - 1)
Text2.Text = Area
Reference = Mid$(strArgs, iLoc2 + 1)
Text3.Text = Reference //////////////// error here
End If
End If
End Sub

--------------------------------------------------------------------------------



Any ideas what I'm doing wrong..


Thanks
 
Reference is a reserved word. Best to change the name, but you could use by putting in brackets. [Reference]
 
Did your try Debug Window?

? Me.OpenArgs

? Iloc1

? Project

? iLoc2

? Reference
 
I changed all reserved words.. and i'm still getting the same error..

thanks for the response..
 
Are these the same as the names on the subform?
Dim Text1, Text2, Text3 As String

If they are then Me.Text3 would reference the subform name
Me.Text3 = YourReferencename

otherwise for the string variable

Text3 = YourReferencename
 
Yes on my form 2 .. I have 3 fields that I want data from current record to display on..

and yes their names are .. text1, text2, and text3

......

ohh yes.. i get a different error message.. I dont know if thats a good thing or not...

run-time error 2185
You can't reference a property or method for a control unless the control has the focus..


Private Sub Form_Open(Cancel As Integer)
Dim strProject As String
Dim strArea As String
Dim strReference As String
Dim Iloc1 As Integer
Dim iLoc2 As String
Dim strArgs As String
Dim Text1, Text2, Text3 As String

strArgs = Me.OpenArgs & ""

If Len(strArgs) > 0 Then
Iloc1 = InStr(strArgs, ";")
If Iloc1 > 0 Then
strProject = Left$(strArgs, Iloc1 - 1)
Me.Text1.Text = strProject
iLoc2 = InStr(Iloc1 + 1, strArgs, ";")
strArea = Mid$(strArgs, Iloc1 + 1, iLoc2 - Iloc1 - 1)
Me.Text2.Text = strArea
strReference = Mid$(strArgs, iLoc2 + 1)
MsgBox strReference ' testing only
Me.Text3.Text = strReference
End If
End If
End Sub
 
The default for a text control is the "text" property. Try leaving off the text/property name. I assume text3 is an unbound text control.

Me.Text3 = strReference
 
Try inserting the lines in [red]red[/red]:

If Len(strArgs) > 0 Then
Iloc1 = InStr(strArgs, ";")
If Iloc1 > 0 Then
strProject = Left$(strArgs, Iloc1 - 1)
[red]Text1.SetFocus[/red]
Text1.Value = strProject
iLoc2 = InStr(Iloc1 + 1, strArgs, ";")
strArea = Mid$(strArgs, Iloc1 + 1, iLoc2 - Iloc1 - 1)
[red]Text2.SetFocus[/red]
Text2.Value = strArea
strReference = Mid$(strArgs, iLoc2 + 1)
MsgBox strReference ' testing only
[red]Text3.SetFocus[/red]
Text3.Value = strReference
[red]Me.Refresh[/red]
End If
End If

I'm not sure but you may care to try replacing the Value property with the Text property. I think it has the same effect.

Also, you could try this:

...
strProject = Left$(strArgs, Iloc1 - 1)
[red]Text1.DefaultValue = strProject[/red]
...

:)
 
cmmrfrds,

got it working after I took off the .text

thanks soo much...

Edski,

Thanks to you too
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top