Can't Open form with OpenArgs

A

Ayo

I am having a very perculiar problem. I have two forms. A siteInfo form and a
SiteConfig form. I have a button on the siteInfo form that I am suppose to
use to open the siteConfig form.
The problem I am having is when I click the button on siteInfo to open
siteConfig using something like this:
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, Me.txtSiteID,

If I have an Open Event in siteConfig I get a "The OpenForm action was
canceled" but if there is no open event in siteConfig, the form opens but
with all the wrong data.

Any ideas what is going on?
 
B

Bonnie

Sorry Ayo - I might be missing something but what does it mean? I'm assuming
there is a control somewhere named txtSiteId but what are you doing with it?
If you want to filter on that control what must it equal?

Bonnie

http://www.dataplus-svc.com
 
A

Ayo

txtSiteID is a contol on the siteInfo form and it is being used as a openargs
argument.
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, OpenArgs:=Me.txtSiteID
 
B

Bonnie

Sorry, I am not that familiar with using it like that. I see in the help
that you can refer to that OpenArgs in code or an event after opeing the form
but I would filter it as I open the form by putting the argument into the
Filter property of the Data tab of the form. Not sure but maybe that's got
something to do with your problem.

Bonnie

http://www.dataplus-svc.com
 
A

Ayo

1.) The problem is not the fact that the argument is "Me.txtSiteID", even
when I used a string like "GSM850" I still get the same problem.

2.) The reason I am using the openArgs is because I am trying to enter a new
record that is linked to the record on the opening form. Filter won't work in
this case because there will be no record to open to.
 
B

boblarson

I posted this in your other post of the same question -

What code are you using in the open event of the form you are passing the
OpenArgs to? That actually may be the culprit.

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________
 
A

Ayo

THE CLICK EVENT OF THE BUTTON
Private Sub cmdConfig_850GSM_Click()
Me.Visible = False
DoCmd.OpenForm "frmSiteConfiguration", acNormal, OpenArgs:="GSM850"
& "," & Me.txtSiteID & "," & Me.txtProjectName
End Sub

THE OPEN EVENT OF THE FORM
Private Sub Form_Open(Cancel As Integer)
commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo

ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) -
commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
DoCmd.OpenForm "frmSiteConfiguration", acNormal, "qry_Combined",
"tbl_SiteInformation.SiteID ='" & SiteID & '"'" & " And
[Config_Technology]='" & ConfigName & "'" & " And
[tbl_SiteInformation.ProjectName]='" & projName & "'"
End If
End Sub
 
B

boblarson

I think I can see the problem. You are currently opening frmSiteConfiguration

yet in the frmSiteConfiguration On Open event you are trying to open it again:

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


Ayo said:
THE CLICK EVENT OF THE BUTTON
Private Sub cmdConfig_850GSM_Click()
Me.Visible = False
DoCmd.OpenForm "frmSiteConfiguration", acNormal, OpenArgs:="GSM850"
& "," & Me.txtSiteID & "," & Me.txtProjectName
End Sub

THE OPEN EVENT OF THE FORM
Private Sub Form_Open(Cancel As Integer)
commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo

ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) -
commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
DoCmd.OpenForm "frmSiteConfiguration", acNormal, "qry_Combined",
"tbl_SiteInformation.SiteID ='" & SiteID & '"'" & " And
[Config_Technology]='" & ConfigName & "'" & " And
[tbl_SiteInformation.ProjectName]='" & projName & "'"
End If
End Sub

boblarson said:
I posted this in your other post of the same question -

What code are you using in the open event of the form you are passing the
OpenArgs to? That actually may be the culprit.

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________
 
A

Ayo

Sorry about that it was suppose to be this:

Private Sub Form_Open()

commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo
ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) - commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
End If
End Sub


boblarson said:
I think I can see the problem. You are currently opening frmSiteConfiguration

yet in the frmSiteConfiguration On Open event you are trying to open it again:

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


Ayo said:
THE CLICK EVENT OF THE BUTTON
Private Sub cmdConfig_850GSM_Click()
Me.Visible = False
DoCmd.OpenForm "frmSiteConfiguration", acNormal, OpenArgs:="GSM850"
& "," & Me.txtSiteID & "," & Me.txtProjectName
End Sub

THE OPEN EVENT OF THE FORM
Private Sub Form_Open(Cancel As Integer)
commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo

ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) -
commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
DoCmd.OpenForm "frmSiteConfiguration", acNormal, "qry_Combined",
"tbl_SiteInformation.SiteID ='" & SiteID & '"'" & " And
[Config_Technology]='" & ConfigName & "'" & " And
[tbl_SiteInformation.ProjectName]='" & projName & "'"
End If
End Sub

boblarson said:
I posted this in your other post of the same question -

What code are you using in the open event of the form you are passing the
OpenArgs to? That actually may be the culprit.

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


:

Thank you very much Bonnie.

:

I see. Yes you can open it filtered to the first form. It's very late and
I'm tired but I'll look at some of my apps and get back tomorrow.

Bonnie
http://www.dataplus-svc.com

:

1.) The problem is not the fact that the argument is "Me.txtSiteID", even
when I used a string like "GSM850" I still get the same problem.

2.) The reason I am using the openArgs is because I am trying to enter a new
record that is linked to the record on the opening form. Filter won't work in
this case because there will be no record to open to.

:

Sorry, I am not that familiar with using it like that. I see in the help
that you can refer to that OpenArgs in code or an event after opeing the form
but I would filter it as I open the form by putting the argument into the
Filter property of the Data tab of the form. Not sure but maybe that's got
something to do with your problem.

Bonnie

http://www.dataplus-svc.com




:

txtSiteID is a contol on the siteInfo form and it is being used as a openargs
argument.
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, OpenArgs:=Me.txtSiteID


:

Sorry Ayo - I might be missing something but what does it mean? I'm assuming
there is a control somewhere named txtSiteId but what are you doing with it?
If you want to filter on that control what must it equal?

Bonnie

http://www.dataplus-svc.com


:

That is the OpenArgs.

:

Hi Ayo,

What is the Me.txtSiteID argument?

Bonnie
http://www.dataplus-svc.com


:

I am having a very perculiar problem. I have two forms. A siteInfo form and a
SiteConfig form. I have a button on the siteInfo form that I am suppose to
use to open the siteConfig form.
The problem I am having is when I click the button on siteInfo to open
siteConfig using something like this:
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, Me.txtSiteID,

If I have an Open Event in siteConfig I get a "The OpenForm action was
canceled" but if there is no open event in siteConfig, the form opens but
with all the wrong data.

Any ideas what is going on?
 
B

boblarson

The only other thing I can see is that your parsing of the Open Args doesn't
take into account nulls. Your commaTwo and commaThree are not going to
return values since your value you are supplying is one value.
--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


Ayo said:
Sorry about that it was suppose to be this:

Private Sub Form_Open()

commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo
ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) - commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
End If
End Sub


boblarson said:
I think I can see the problem. You are currently opening frmSiteConfiguration

yet in the frmSiteConfiguration On Open event you are trying to open it again:

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


Ayo said:
THE CLICK EVENT OF THE BUTTON
Private Sub cmdConfig_850GSM_Click()
Me.Visible = False
DoCmd.OpenForm "frmSiteConfiguration", acNormal, OpenArgs:="GSM850"
& "," & Me.txtSiteID & "," & Me.txtProjectName
End Sub

THE OPEN EVENT OF THE FORM
Private Sub Form_Open(Cancel As Integer)
commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo

ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) -
commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
DoCmd.OpenForm "frmSiteConfiguration", acNormal, "qry_Combined",
"tbl_SiteInformation.SiteID ='" & SiteID & '"'" & " And
[Config_Technology]='" & ConfigName & "'" & " And
[tbl_SiteInformation.ProjectName]='" & projName & "'"
End If
End Sub

:

I posted this in your other post of the same question -

What code are you using in the open event of the form you are passing the
OpenArgs to? That actually may be the culprit.

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


:

Thank you very much Bonnie.

:

I see. Yes you can open it filtered to the first form. It's very late and
I'm tired but I'll look at some of my apps and get back tomorrow.

Bonnie
http://www.dataplus-svc.com

:

1.) The problem is not the fact that the argument is "Me.txtSiteID", even
when I used a string like "GSM850" I still get the same problem.

2.) The reason I am using the openArgs is because I am trying to enter a new
record that is linked to the record on the opening form. Filter won't work in
this case because there will be no record to open to.

:

Sorry, I am not that familiar with using it like that. I see in the help
that you can refer to that OpenArgs in code or an event after opeing the form
but I would filter it as I open the form by putting the argument into the
Filter property of the Data tab of the form. Not sure but maybe that's got
something to do with your problem.

Bonnie

http://www.dataplus-svc.com




:

txtSiteID is a contol on the siteInfo form and it is being used as a openargs
argument.
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, OpenArgs:=Me.txtSiteID


:

Sorry Ayo - I might be missing something but what does it mean? I'm assuming
there is a control somewhere named txtSiteId but what are you doing with it?
If you want to filter on that control what must it equal?

Bonnie

http://www.dataplus-svc.com


:

That is the OpenArgs.

:

Hi Ayo,

What is the Me.txtSiteID argument?

Bonnie
http://www.dataplus-svc.com


:

I am having a very perculiar problem. I have two forms. A siteInfo form and a
SiteConfig form. I have a button on the siteInfo form that I am suppose to
use to open the siteConfig form.
The problem I am having is when I click the button on siteInfo to open
siteConfig using something like this:
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, Me.txtSiteID,

If I have an Open Event in siteConfig I get a "The OpenForm action was
canceled" but if there is no open event in siteConfig, the form opens but
with all the wrong data.

Any ideas what is going on?
 
A

Ayo

This is a longer value of this to account for that, I was trying to touble
shoot the problem that was why I removed it to see if I can pin point where
the issue was but nothing worked. I have 2 sets of identical forms.
Everything works fine in one set but not for the other set.
If you want to see what I have I would be happy to send it over for you to
take a look see. I am completely stuck right now because I can't figure out
what the problem is.

Private Sub cmdConfig_850GSM_Click()
Me.Visible = False
DoCmd.OpenForm "frmSiteConfiguration", acNormal, OpenArgs:="GSM850"
& "," & Me.txtSiteID & "," & Me.txtProjectName
End Sub


boblarson said:
The only other thing I can see is that your parsing of the Open Args doesn't
take into account nulls. Your commaTwo and commaThree are not going to
return values since your value you are supplying is one value.
--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


Ayo said:
Sorry about that it was suppose to be this:

Private Sub Form_Open()

commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo
ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) - commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
End If
End Sub


boblarson said:
I think I can see the problem. You are currently opening frmSiteConfiguration

yet in the frmSiteConfiguration On Open event you are trying to open it again:

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


:

THE CLICK EVENT OF THE BUTTON
Private Sub cmdConfig_850GSM_Click()
Me.Visible = False
DoCmd.OpenForm "frmSiteConfiguration", acNormal, OpenArgs:="GSM850"
& "," & Me.txtSiteID & "," & Me.txtProjectName
End Sub

THE OPEN EVENT OF THE FORM
Private Sub Form_Open(Cancel As Integer)
commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo

ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) -
commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
DoCmd.OpenForm "frmSiteConfiguration", acNormal, "qry_Combined",
"tbl_SiteInformation.SiteID ='" & SiteID & '"'" & " And
[Config_Technology]='" & ConfigName & "'" & " And
[tbl_SiteInformation.ProjectName]='" & projName & "'"
End If
End Sub

:

I posted this in your other post of the same question -

What code are you using in the open event of the form you are passing the
OpenArgs to? That actually may be the culprit.

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


:

Thank you very much Bonnie.

:

I see. Yes you can open it filtered to the first form. It's very late and
I'm tired but I'll look at some of my apps and get back tomorrow.

Bonnie
http://www.dataplus-svc.com

:

1.) The problem is not the fact that the argument is "Me.txtSiteID", even
when I used a string like "GSM850" I still get the same problem.

2.) The reason I am using the openArgs is because I am trying to enter a new
record that is linked to the record on the opening form. Filter won't work in
this case because there will be no record to open to.

:

Sorry, I am not that familiar with using it like that. I see in the help
that you can refer to that OpenArgs in code or an event after opeing the form
but I would filter it as I open the form by putting the argument into the
Filter property of the Data tab of the form. Not sure but maybe that's got
something to do with your problem.

Bonnie

http://www.dataplus-svc.com




:

txtSiteID is a contol on the siteInfo form and it is being used as a openargs
argument.
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, OpenArgs:=Me.txtSiteID


:

Sorry Ayo - I might be missing something but what does it mean? I'm assuming
there is a control somewhere named txtSiteId but what are you doing with it?
If you want to filter on that control what must it equal?

Bonnie

http://www.dataplus-svc.com


:

That is the OpenArgs.

:

Hi Ayo,

What is the Me.txtSiteID argument?

Bonnie
http://www.dataplus-svc.com


:

I am having a very perculiar problem. I have two forms. A siteInfo form and a
SiteConfig form. I have a button on the siteInfo form that I am suppose to
use to open the siteConfig form.
The problem I am having is when I click the button on siteInfo to open
siteConfig using something like this:
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, Me.txtSiteID,

If I have an Open Event in siteConfig I get a "The OpenForm action was
canceled" but if there is no open event in siteConfig, the form opens but
with all the wrong data.

Any ideas what is going on?
 
B

boblarson

Go ahead and send it to me (Compact and Repair first and then zip it). You
can use the email address at the Contact Me link on my website (see my
signature).
--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


Ayo said:
This is a longer value of this to account for that, I was trying to touble
shoot the problem that was why I removed it to see if I can pin point where
the issue was but nothing worked. I have 2 sets of identical forms.
Everything works fine in one set but not for the other set.
If you want to see what I have I would be happy to send it over for you to
take a look see. I am completely stuck right now because I can't figure out
what the problem is.

Private Sub cmdConfig_850GSM_Click()
Me.Visible = False
DoCmd.OpenForm "frmSiteConfiguration", acNormal, OpenArgs:="GSM850"
& "," & Me.txtSiteID & "," & Me.txtProjectName
End Sub


boblarson said:
The only other thing I can see is that your parsing of the Open Args doesn't
take into account nulls. Your commaTwo and commaThree are not going to
return values since your value you are supplying is one value.
--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


Ayo said:
Sorry about that it was suppose to be this:

Private Sub Form_Open()

commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo
ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) - commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
End If
End Sub


:

I think I can see the problem. You are currently opening frmSiteConfiguration

yet in the frmSiteConfiguration On Open event you are trying to open it again:

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


:

THE CLICK EVENT OF THE BUTTON
Private Sub cmdConfig_850GSM_Click()
Me.Visible = False
DoCmd.OpenForm "frmSiteConfiguration", acNormal, OpenArgs:="GSM850"
& "," & Me.txtSiteID & "," & Me.txtProjectName
End Sub

THE OPEN EVENT OF THE FORM
Private Sub Form_Open(Cancel As Integer)
commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo

ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) -
commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
DoCmd.OpenForm "frmSiteConfiguration", acNormal, "qry_Combined",
"tbl_SiteInformation.SiteID ='" & SiteID & '"'" & " And
[Config_Technology]='" & ConfigName & "'" & " And
[tbl_SiteInformation.ProjectName]='" & projName & "'"
End If
End Sub

:

I posted this in your other post of the same question -

What code are you using in the open event of the form you are passing the
OpenArgs to? That actually may be the culprit.

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


:

Thank you very much Bonnie.

:

I see. Yes you can open it filtered to the first form. It's very late and
I'm tired but I'll look at some of my apps and get back tomorrow.

Bonnie
http://www.dataplus-svc.com

:

1.) The problem is not the fact that the argument is "Me.txtSiteID", even
when I used a string like "GSM850" I still get the same problem.

2.) The reason I am using the openArgs is because I am trying to enter a new
record that is linked to the record on the opening form. Filter won't work in
this case because there will be no record to open to.

:

Sorry, I am not that familiar with using it like that. I see in the help
that you can refer to that OpenArgs in code or an event after opeing the form
but I would filter it as I open the form by putting the argument into the
Filter property of the Data tab of the form. Not sure but maybe that's got
something to do with your problem.

Bonnie

http://www.dataplus-svc.com




:

txtSiteID is a contol on the siteInfo form and it is being used as a openargs
argument.
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, OpenArgs:=Me.txtSiteID


:

Sorry Ayo - I might be missing something but what does it mean? I'm assuming
there is a control somewhere named txtSiteId but what are you doing with it?
If you want to filter on that control what must it equal?

Bonnie

http://www.dataplus-svc.com


:

That is the OpenArgs.

:

Hi Ayo,

What is the Me.txtSiteID argument?

Bonnie
http://www.dataplus-svc.com


:

I am having a very perculiar problem. I have two forms. A siteInfo form and a
SiteConfig form. I have a button on the siteInfo form that I am suppose to
use to open the siteConfig form.
The problem I am having is when I click the button on siteInfo to open
siteConfig using something like this:
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, Me.txtSiteID,

If I have an Open Event in siteConfig I get a "The OpenForm action was
canceled" but if there is no open event in siteConfig, the form opens but
with all the wrong data.

Any ideas what is going on?
 
B

boblarson

Okay, for one I found that you are trying to name some variables the same
name as your field names (SiteID for one). Rename your variables to Dim
strSiteID As String and rename the parts in your Open code that have that. I
think you really do need to implement some code for ensuring that all
arguments are supplied or else if null it bypasses them. It is a problem
while going through this.
--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


Ayo said:
This is a longer value of this to account for that, I was trying to touble
shoot the problem that was why I removed it to see if I can pin point where
the issue was but nothing worked. I have 2 sets of identical forms.
Everything works fine in one set but not for the other set.
If you want to see what I have I would be happy to send it over for you to
take a look see. I am completely stuck right now because I can't figure out
what the problem is.

Private Sub cmdConfig_850GSM_Click()
Me.Visible = False
DoCmd.OpenForm "frmSiteConfiguration", acNormal, OpenArgs:="GSM850"
& "," & Me.txtSiteID & "," & Me.txtProjectName
End Sub


boblarson said:
The only other thing I can see is that your parsing of the Open Args doesn't
take into account nulls. Your commaTwo and commaThree are not going to
return values since your value you are supplying is one value.
--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


Ayo said:
Sorry about that it was suppose to be this:

Private Sub Form_Open()

commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo
ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) - commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
End If
End Sub


:

I think I can see the problem. You are currently opening frmSiteConfiguration

yet in the frmSiteConfiguration On Open event you are trying to open it again:

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


:

THE CLICK EVENT OF THE BUTTON
Private Sub cmdConfig_850GSM_Click()
Me.Visible = False
DoCmd.OpenForm "frmSiteConfiguration", acNormal, OpenArgs:="GSM850"
& "," & Me.txtSiteID & "," & Me.txtProjectName
End Sub

THE OPEN EVENT OF THE FORM
Private Sub Form_Open(Cancel As Integer)
commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",") + commaOne
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",") + commaTwo

ConfigName = Left(Me.OpenArgs, commaOne - 1)
SiteID = Mid(Me.OpenArgs, commaOne + 1, (commaTwo - 1) - commaOne)
UMTS_ID = Mid(Me.OpenArgs, commaTwo + 1, (commaThree - 1) -
commaTwo)
projName = Mid(Me.OpenArgs, commaThree + 1)

If Not IsNull(Me.OpenArgs) Then
Me.txtUMTS_ID = UMTS_ID
Me.Caption = ConfigName & " Configuration for " & SiteID
Me.PgTechnology.Caption = Me.OpenArgs & " Antenna System
Configuration" 'ConfigName & " Antenna System Configuration"
Me.txtProjectName = projName
DoCmd.OpenForm "frmSiteConfiguration", acNormal, "qry_Combined",
"tbl_SiteInformation.SiteID ='" & SiteID & '"'" & " And
[Config_Technology]='" & ConfigName & "'" & " And
[tbl_SiteInformation.ProjectName]='" & projName & "'"
End If
End Sub

:

I posted this in your other post of the same question -

What code are you using in the open event of the form you are passing the
OpenArgs to? That actually may be the culprit.

--
Bob Larson
Access World Forums Administrator

Tutorials at http://www.btabdevelopment.com

__________________________________


:

Thank you very much Bonnie.

:

I see. Yes you can open it filtered to the first form. It's very late and
I'm tired but I'll look at some of my apps and get back tomorrow.

Bonnie
http://www.dataplus-svc.com

:

1.) The problem is not the fact that the argument is "Me.txtSiteID", even
when I used a string like "GSM850" I still get the same problem.

2.) The reason I am using the openArgs is because I am trying to enter a new
record that is linked to the record on the opening form. Filter won't work in
this case because there will be no record to open to.

:

Sorry, I am not that familiar with using it like that. I see in the help
that you can refer to that OpenArgs in code or an event after opeing the form
but I would filter it as I open the form by putting the argument into the
Filter property of the Data tab of the form. Not sure but maybe that's got
something to do with your problem.

Bonnie

http://www.dataplus-svc.com




:

txtSiteID is a contol on the siteInfo form and it is being used as a openargs
argument.
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, OpenArgs:=Me.txtSiteID


:

Sorry Ayo - I might be missing something but what does it mean? I'm assuming
there is a control somewhere named txtSiteId but what are you doing with it?
If you want to filter on that control what must it equal?

Bonnie

http://www.dataplus-svc.com


:

That is the OpenArgs.

:

Hi Ayo,

What is the Me.txtSiteID argument?

Bonnie
http://www.dataplus-svc.com


:

I am having a very perculiar problem. I have two forms. A siteInfo form and a
SiteConfig form. I have a button on the siteInfo form that I am suppose to
use to open the siteConfig form.
The problem I am having is when I click the button on siteInfo to open
siteConfig using something like this:
DoCmd.OpenForm "frmSiteConfiguration_Input", acNormal, , , acFormEdit,
acWindowNormal, Me.txtSiteID,

If I have an Open Event in siteConfig I get a "The OpenForm action was
canceled" but if there is no open event in siteConfig, the form opens but
with all the wrong data.

Any ideas what is going on?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top