a "popup" form

P

Pwyd

On a status page, i have a query-fed list box (which has multiple columns).
what i'd like to do is when someoen clicks on one of the records, i'd like it
to open up a small form that shows some information that isn't shown in the
listbox already (there isn't any room and it'd look crappy.)

Batch Status Page is the original form. Earliest Date in Batch is the
"subform" if you will. It will be opened, and i'd like it to simply show the
earliest date in the batch related to the record i've clicked on, in the
"subform." It won't let me assign data to that member though, probably
because i do not know how to parse out everything except the batch number in
that listbox.


Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & [Forms]![Batch Status Page]![List94]
Me.FilterOn = True

End Sub
 
P

Pwyd

Okay, scratch that. i've amended it, as i'd left out the other quotes:

Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
Me.FilterOn = True

End Sub

so it opens up the sub-form properly. Unfortunately, its not filtering to
show only the record i'd clicked on.
 
D

Dale Fye

Try:

Private Sub List94_Click()

Dim strCriteria as string
strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

End Sub

However, since the purpose of the listbox is normally to select an item from
the list, using the click event might be a bit obnoxious. The way I
generally do it is to use the MouseUp event, and check to see whether the
Button pressed was acRightButton. That way, if the user just clicks on the
item, the "more info" box does not pop up, but if they right click, the info
box does popup.

Private Sub lst_People_MouseUp(Button As Integer, Shift As Integer, _
X As Single, Y As Single)

Dim strCriteria as string

If Button = acRightButton Then

strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status
Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

end if

End Sub

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Pwyd said:
Okay, scratch that. i've amended it, as i'd left out the other quotes:

Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
Me.FilterOn = True

End Sub

so it opens up the sub-form properly. Unfortunately, its not filtering to
show only the record i'd clicked on.



Pwyd said:
On a status page, i have a query-fed list box (which has multiple columns).
what i'd like to do is when someoen clicks on one of the records, i'd like it
to open up a small form that shows some information that isn't shown in the
listbox already (there isn't any room and it'd look crappy.)

Batch Status Page is the original form. Earliest Date in Batch is the
"subform" if you will. It will be opened, and i'd like it to simply show the
earliest date in the batch related to the record i've clicked on, in the
"subform." It won't let me assign data to that member though, probably
because i do not know how to parse out everything except the batch number in
that listbox.


Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & [Forms]![Batch Status Page]![List94]
Me.FilterOn = True

End Sub
 
P

Pwyd

Thats a great idea, thanks Dale, i'll give it a try.



Dale Fye said:
Try:

Private Sub List94_Click()

Dim strCriteria as string
strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

End Sub

However, since the purpose of the listbox is normally to select an item from
the list, using the click event might be a bit obnoxious. The way I
generally do it is to use the MouseUp event, and check to see whether the
Button pressed was acRightButton. That way, if the user just clicks on the
item, the "more info" box does not pop up, but if they right click, the info
box does popup.

Private Sub lst_People_MouseUp(Button As Integer, Shift As Integer, _
X As Single, Y As Single)

Dim strCriteria as string

If Button = acRightButton Then

strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status
Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

end if

End Sub

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Pwyd said:
Okay, scratch that. i've amended it, as i'd left out the other quotes:

Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
Me.FilterOn = True

End Sub

so it opens up the sub-form properly. Unfortunately, its not filtering to
show only the record i'd clicked on.



Pwyd said:
On a status page, i have a query-fed list box (which has multiple columns).
what i'd like to do is when someoen clicks on one of the records, i'd like it
to open up a small form that shows some information that isn't shown in the
listbox already (there isn't any room and it'd look crappy.)

Batch Status Page is the original form. Earliest Date in Batch is the
"subform" if you will. It will be opened, and i'd like it to simply show the
earliest date in the batch related to the record i've clicked on, in the
"subform." It won't let me assign data to that member though, probably
because i do not know how to parse out everything except the batch number in
that listbox.


Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & [Forms]![Batch Status Page]![List94]
Me.FilterOn = True

End Sub
 
P

Pwyd

Dale it seems to be opening up to the same unrelated record each time -- Its
not showing the information for that record. Just the default value for the
field.



Dale Fye said:
Try:

Private Sub List94_Click()

Dim strCriteria as string
strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

End Sub

However, since the purpose of the listbox is normally to select an item from
the list, using the click event might be a bit obnoxious. The way I
generally do it is to use the MouseUp event, and check to see whether the
Button pressed was acRightButton. That way, if the user just clicks on the
item, the "more info" box does not pop up, but if they right click, the info
box does popup.

Private Sub lst_People_MouseUp(Button As Integer, Shift As Integer, _
X As Single, Y As Single)

Dim strCriteria as string

If Button = acRightButton Then

strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status
Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

end if

End Sub

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Pwyd said:
Okay, scratch that. i've amended it, as i'd left out the other quotes:

Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
Me.FilterOn = True

End Sub

so it opens up the sub-form properly. Unfortunately, its not filtering to
show only the record i'd clicked on.



Pwyd said:
On a status page, i have a query-fed list box (which has multiple columns).
what i'd like to do is when someoen clicks on one of the records, i'd like it
to open up a small form that shows some information that isn't shown in the
listbox already (there isn't any room and it'd look crappy.)

Batch Status Page is the original form. Earliest Date in Batch is the
"subform" if you will. It will be opened, and i'd like it to simply show the
earliest date in the batch related to the record i've clicked on, in the
"subform." It won't let me assign data to that member though, probably
because i do not know how to parse out everything except the batch number in
that listbox.


Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & [Forms]![Batch Status Page]![List94]
Me.FilterOn = True

End Sub
 
D

Dale Fye

BTW, The criteria line is wrong. It should read:

strCriteria = "[Batchnumber] = " & [Forms]![Batch Status Page]![List94]

which you can actually shorten to:

strCriteria = "[Batchnumber] = " & me.[List94]

Keeping in mind that this will not work if the listbox has the Multi-Select
property set to Simple or Extended. It will also not work if the bound field
of the list is a text value, rather than a number. If that is the case, then
use:

strCriteria = "[Batchnumber] = '" & me.[List94] & "'"


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Pwyd said:
Thats a great idea, thanks Dale, i'll give it a try.



Dale Fye said:
Try:

Private Sub List94_Click()

Dim strCriteria as string
strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

End Sub

However, since the purpose of the listbox is normally to select an item from
the list, using the click event might be a bit obnoxious. The way I
generally do it is to use the MouseUp event, and check to see whether the
Button pressed was acRightButton. That way, if the user just clicks on the
item, the "more info" box does not pop up, but if they right click, the info
box does popup.

Private Sub lst_People_MouseUp(Button As Integer, Shift As Integer, _
X As Single, Y As Single)

Dim strCriteria as string

If Button = acRightButton Then

strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status
Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

end if

End Sub

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Pwyd said:
Okay, scratch that. i've amended it, as i'd left out the other quotes:

Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
Me.FilterOn = True

End Sub

so it opens up the sub-form properly. Unfortunately, its not filtering to
show only the record i'd clicked on.



:

On a status page, i have a query-fed list box (which has multiple columns).
what i'd like to do is when someoen clicks on one of the records, i'd like it
to open up a small form that shows some information that isn't shown in the
listbox already (there isn't any room and it'd look crappy.)

Batch Status Page is the original form. Earliest Date in Batch is the
"subform" if you will. It will be opened, and i'd like it to simply show the
earliest date in the batch related to the record i've clicked on, in the
"subform." It won't let me assign data to that member though, probably
because i do not know how to parse out everything except the batch number in
that listbox.


Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & [Forms]![Batch Status Page]![List94]
Me.FilterOn = True

End Sub
 
P

Pwyd

All right. that seems to work. Another question. How could i make it so
instead of it requiring itself to be closed before going back to peruse the
main form, it would refresh every time a new record was clicked on in the
listbox?


Dale Fye said:
BTW, The criteria line is wrong. It should read:

strCriteria = "[Batchnumber] = " & [Forms]![Batch Status Page]![List94]

which you can actually shorten to:

strCriteria = "[Batchnumber] = " & me.[List94]

Keeping in mind that this will not work if the listbox has the Multi-Select
property set to Simple or Extended. It will also not work if the bound field
of the list is a text value, rather than a number. If that is the case, then
use:

strCriteria = "[Batchnumber] = '" & me.[List94] & "'"


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Pwyd said:
Thats a great idea, thanks Dale, i'll give it a try.



Dale Fye said:
Try:

Private Sub List94_Click()

Dim strCriteria as string
strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

End Sub

However, since the purpose of the listbox is normally to select an item from
the list, using the click event might be a bit obnoxious. The way I
generally do it is to use the MouseUp event, and check to see whether the
Button pressed was acRightButton. That way, if the user just clicks on the
item, the "more info" box does not pop up, but if they right click, the info
box does popup.

Private Sub lst_People_MouseUp(Button As Integer, Shift As Integer, _
X As Single, Y As Single)

Dim strCriteria as string

If Button = acRightButton Then

strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status
Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

end if

End Sub

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

Okay, scratch that. i've amended it, as i'd left out the other quotes:

Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
Me.FilterOn = True

End Sub

so it opens up the sub-form properly. Unfortunately, its not filtering to
show only the record i'd clicked on.



:

On a status page, i have a query-fed list box (which has multiple columns).
what i'd like to do is when someoen clicks on one of the records, i'd like it
to open up a small form that shows some information that isn't shown in the
listbox already (there isn't any room and it'd look crappy.)

Batch Status Page is the original form. Earliest Date in Batch is the
"subform" if you will. It will be opened, and i'd like it to simply show the
earliest date in the batch related to the record i've clicked on, in the
"subform." It won't let me assign data to that member though, probably
because i do not know how to parse out everything except the batch number in
that listbox.


Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & [Forms]![Batch Status Page]![List94]
Me.FilterOn = True

End Sub
 
D

Dale Fye

1. You cannot use the acDialog argument, so remove that from the
docmd.openform line. That particular argument opens the form as modal so
that it has to be closed before you can do anything on the main form.

2. Try the following:

Private Sub lst_People_MouseUp(Button As Integer, Shift As Integer, _
X As Single, Y As Single)

Dim strCriteria as string

If Button = acRightButton Then

strCriteria = "[Batchnumber] = " & me.lst94

if currentproject.allforms("Earliest Date in Batch").isloaded then
forms("Earliest Date in Batch").Filter = strCriteria
forms("Earliest Date in Batch").FilterOn = true
forms("Earliest Date in Batch").setfocus
else
docmd.OpenForm "Earliest Date in Batch",,,strCriteria
endif
end if
End Sub

This should change the filter in the popup form, if it is already loaded,
but load it if it is not already loaded.
--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Pwyd said:
All right. that seems to work. Another question. How could i make it so
instead of it requiring itself to be closed before going back to peruse the
main form, it would refresh every time a new record was clicked on in the
listbox?


Dale Fye said:
BTW, The criteria line is wrong. It should read:

strCriteria = "[Batchnumber] = " & [Forms]![Batch Status Page]![List94]

which you can actually shorten to:

strCriteria = "[Batchnumber] = " & me.[List94]

Keeping in mind that this will not work if the listbox has the Multi-Select
property set to Simple or Extended. It will also not work if the bound field
of the list is a text value, rather than a number. If that is the case, then
use:

strCriteria = "[Batchnumber] = '" & me.[List94] & "'"


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Pwyd said:
Thats a great idea, thanks Dale, i'll give it a try.



:

Try:

Private Sub List94_Click()

Dim strCriteria as string
strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

End Sub

However, since the purpose of the listbox is normally to select an item from
the list, using the click event might be a bit obnoxious. The way I
generally do it is to use the MouseUp event, and check to see whether the
Button pressed was acRightButton. That way, if the user just clicks on the
item, the "more info" box does not pop up, but if they right click, the info
box does popup.

Private Sub lst_People_MouseUp(Button As Integer, Shift As Integer, _
X As Single, Y As Single)

Dim strCriteria as string

If Button = acRightButton Then

strCriteria = "[Batchnumber] = " & "[Forms]![Batch Status
Page]![List94]"
docmd.OpenForm "Earliest Date in Batch",,,strCriteria,,acDialog

end if

End Sub

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

Okay, scratch that. i've amended it, as i'd left out the other quotes:

Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & "[Forms]![Batch Status Page]![List94]"
Me.FilterOn = True

End Sub

so it opens up the sub-form properly. Unfortunately, its not filtering to
show only the record i'd clicked on.



:

On a status page, i have a query-fed list box (which has multiple columns).
what i'd like to do is when someoen clicks on one of the records, i'd like it
to open up a small form that shows some information that isn't shown in the
listbox already (there isn't any room and it'd look crappy.)

Batch Status Page is the original form. Earliest Date in Batch is the
"subform" if you will. It will be opened, and i'd like it to simply show the
earliest date in the batch related to the record i've clicked on, in the
"subform." It won't let me assign data to that member though, probably
because i do not know how to parse out everything except the batch number in
that listbox.


Private Sub List94_Click()
DoCmd.OpenForm ("Earliest Date in Batch")
Me.Filter = "[Batchnumber] = " & [Forms]![Batch Status Page]![List94]
Me.FilterOn = True

End Sub
 

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