Form Opens to record if Like

  • Thread starter Thread starter golfinray
  • Start date Start date
G

golfinray

I am using:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "07-09 Master new2"

stLinkCriteria = "[final Project ID#]=" & "'" & Me![New Project ID#] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
to open a form to a record in another form. That works great. What I want to
do is see if that record is the proper type (0607 project or 0709 project)
before it opens.
I tried (when people try to open an 0607 project with an 0709 project open)
if (me.[final project ID#]) like "0709-####-###*" then
msgbox "Please select an 0607 project"
end if
strlinkcriteria
etc
I can't get anything to work. HELP!!! Thanks so much!!!
 
Yes, If they select an 0607 project on the mainform, it goes to the project
no problem. If they select an 0607 project and then push the View 0709
project button, they get a blank screen. If they select an 0709 project and
that is actually an 0607 project number they get a blank screen. All I'm
trying to do is give them a message that they are trying to open the worng
project. Thanks!
--
Milton Purdy
ACCESS
State of Arkansas


Software-Matters via AccessMonster.com said:
Hi,
Could you put which project it is connected to on the actual form that you
are coming from?
Then you don't need the test.

Regards
JD
I am using:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "07-09 Master new2"

stLinkCriteria = "[final Project ID#]=" & "'" & Me![New Project ID#] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
to open a form to a record in another form. That works great. What I want to
do is see if that record is the proper type (0607 project or 0709 project)
before it opens.
I tried (when people try to open an 0607 project with an 0709 project open)
if (me.[final project ID#]) like "0709-####-###*" then
msgbox "Please select an 0607 project"
end if
strlinkcriteria
etc
I can't get anything to work. HELP!!! Thanks so much!!!

--
<a href="
http://www.software-matters.co.uk/bespoke-database-design.html">Bespoke
Access Database Development</a>
<p>Software Matters</br>
Straightforward solutions that work</p>

Message posted via AccessMonster.com
 
I am using:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "07-09 Master new2"

stLinkCriteria = "[final Project ID#]=" & "'" & Me![New Project ID#] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
to open a form to a record in another form. That works great. What I want to
do is see if that record is the proper type (0607 project or 0709 project)
before it opens.
I tried (when people try to open an 0607 project with an 0709 project open)
if (me.[final project ID#]) like "0709-####-###*" then
msgbox "Please select an 0607 project"
end if
strlinkcriteria
etc
I can't get anything to work. HELP!!! Thanks so much!!!

Why not base the form on a query returning only the correct projects? Are
users typing freeform text into the [New Project ID#] textbox, or is this
being drawn from a table?
 
Yes, that is what I needed. If they are on an 0607 project they hit the view
0607 Master button, if on 0709, they hit the 0709 Master button and view the
details. Thanks!
--
Milton Purdy
ACCESS
State of Arkansas


Software-Matters via AccessMonster.com said:
Ok, I now see what you are tryiong to achieve but am a little confused about
the buttons.
Do you have a view 0709 button and view 0607 button? Are there any other view
buttons?

If you have 2 buttons I would just hide the button that is not relevant
depending on the ID as follows:

if me!FinalProjectID = 0607 then
me!View0607Button.visible = True
me!view0709Button.visible = False
else
me!View0607Button.visible = True
me!view0709Button.visible = False
end if

You will need to add this code to the OnCurrent of the form and the
AfterUpdate of the FinalProjectID field.

Does this help. If not please givev me some more info
Regards
JD
Yes, If they select an 0607 project on the mainform, it goes to the project
no problem. If they select an 0607 project and then push the View 0709
project button, they get a blank screen. If they select an 0709 project and
that is actually an 0607 project number they get a blank screen. All I'm
trying to do is give them a message that they are trying to open the worng
project. Thanks!
Hi,
Could you put which project it is connected to on the actual form that you
[quoted text clipped - 22 lines]
etc
I can't get anything to work. HELP!!! Thanks so much!!!

--
<a href="
http://www.software-matters.co.uk/bespoke-database-design.html">Bespoke
Access Database Development</a>
<p>Software Matters</br>
Straightforward solutions that work</p>

Message posted via AccessMonster.com
 
It is coming from tables. Thanks.
--
Milton Purdy
ACCESS
State of Arkansas


John W. Vinson said:
I am using:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "07-09 Master new2"

stLinkCriteria = "[final Project ID#]=" & "'" & Me![New Project ID#] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
to open a form to a record in another form. That works great. What I want to
do is see if that record is the proper type (0607 project or 0709 project)
before it opens.
I tried (when people try to open an 0607 project with an 0709 project open)
if (me.[final project ID#]) like "0709-####-###*" then
msgbox "Please select an 0607 project"
end if
strlinkcriteria
etc
I can't get anything to work. HELP!!! Thanks so much!!!

Why not base the form on a query returning only the correct projects? Are
users typing freeform text into the [New Project ID#] textbox, or is this
being drawn from a table?
 
Back
Top