Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

Opening form to specific record\

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BRC - 09 Jun 2007 22:52 GMT
Hi all

I am trying to open a form to a specific record based on dbl clicking
a record on the sub form of another form. Here is the situation.
Form1 (SelReceditFrm ) is open with a date field where user enters
date
after user selects date all "events" for that date show up in subform.
When user dblclicks on an event listed in the subform I want the event
form("eventtfrm" to upen to that record in the edit mode.
when the user dbl clicks on the event I set a message box to display
the "eventKey" which is the event i want to edit.
this is the code
Private Sub event_DblClick(Cancel As Integer)
dim evk as interger
'evnetkey is an auto number field
evk = Me.EventKey
MsgBox (evk)
'DoCmd.OpenForm "eventFrm", , "[eventkey]='" & evk& "' "
'DoCmd.OpenForm "eventFrm", acNormal, , EventKey = evk, acFormEdit
'DoCmd.OpenForm "eventFrm", acNormal, filt, EventKey = filt,
acFormedit,,,)
End Sub
my problem may have something to do with punctuation but I can't find
a good explanation of how to punctuate.
Ken Snell (MVP) - 10 Jun 2007 00:04 GMT
The fourth argument is the one you use to send the filtering string to the
form that is being opened. In your code, you have your string as the third
argument. Try this:

DoCmd.OpenForm "eventFrm", , , "[eventkey]='" & evk& "'"

Signature

       Ken Snell
<MS ACCESS MVP>

> Hi all
>
[quoted text clipped - 20 lines]
> my problem may have something to do with punctuation but I can't find
> a good explanation of how to punctuate.
BRC - 10 Jun 2007 01:35 GMT
On Jun 9, 4:04 pm, "Ken Snell \(MVP\)"
<kthsneisll...@ncoomcastt.renaetl> wrote:
> The fourth argument is the one you use to send the filtering string to the
> form that is being opened. In your code, you have your string as the third
[quoted text clipped - 33 lines]
>
> - Show quoted text -

Ken,
Thank you.
I did have the argument in the wrong position.  Here is the code that
actually works the way I wanted:
***************************
Private Sub event_DblClick(Cancel As Integer)
Dim evk As String     'Integer
evk = Me.EventKey
MsgBox (evk)
DoCmd.OpenForm "eventFrm", , , "[eventkey]=" & evk, acFormEdit
End Sub
*******************************
It didn't seem to matter if i dim'd evk as string or integer. I think
my problem is i don't really understand the syntax and punctuation of
these statements. i.e. when to use quotes, brakets etc. If you know of
any good references for this type of thing I would appreicate the
advise. Thanks again
BRC
Ken Snell (MVP) - 10 Jun 2007 03:11 GMT
If a field is a number field, you do not use any delimiter.

If a field is a text or memo field, you use a ' delimiter.

If a field is a date/time field, you use a # delimiter if you're passing a
"mm/dd/yyyy" , "hh:nn:ss" , or "mm/dd/yyyy hh:nn:ss" type of date/time.
Remember that Jet will assume US format of date if you provide it with an
ambigous date (e.g., 03/05/2007 -- which is March 5, 2007 in US, and May 3,
2007 in Europe and elsewhere).

Signature

       Ken Snell
<MS ACCESS MVP>

> On Jun 9, 4:04 pm, "Ken Snell \(MVP\)"
> <kthsneisll...@ncoomcastt.renaetl> wrote:
[quoted text clipped - 56 lines]
> advise. Thanks again
> BRC
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.