Open form with specific record, but other records accessible

I have been pulling my hair out trying to figure out how to pull this
off, what I have is a list of the records in the database and a way to
open the detailed form showing more data. But when I used the wizard
to make the command button it prevents me from changing the record in
the detailed form as it is locked onto the choosen record which is no
good as I want the user to be able to pick another record. What is the
best way to pull this off?
0
Cpthooker
3/16/2010 1:15:22 PM
access.formscoding 7493 articles. 0 followers. Follow

11 Replies
1145 Views

Similar Articles

[PageSpeed] 43

Open the form without supplying a where clause, and pass the ID of the record 
you want as the OpenArg... in the Open event of the detail form, use the 
recordset bookmark to make the said ID current.  For this example we'll 
pretend you have a numeric ID:

Private Sub Form_Open(Cancel As Integer)
  Dim lID As Long
  lID = Clng(Me.OpenArgs)

  With Me.RecordsetClone
    .FindFirst "[IDField] = " & lID
    If .NoMatch Then
      MsgBox "Record Not Found!"
    Else
      Me.Bookmark = .Bookmark
    End If
  End With

End Sub


hth
-- 
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."  
-Thomas Edison (1847-1931) 



"Cpthooker" wrote:

> I have been pulling my hair out trying to figure out how to pull this
> off, what I have is a list of the records in the database and a way to
> open the detailed form showing more data. But when I used the wizard
> to make the command button it prevents me from changing the record in
> the detailed form as it is locked onto the choosen record which is no
> good as I want the user to be able to pick another record. What is the
> best way to pull this off?
> .
> 
0
Utf
3/16/2010 2:24:01 PM
On Mar 16, 2:24=A0pm, Jack Leach <dymondjack at hot mail dot com> wrote:
> Open the form without supplying a where clause, and pass the ID of the re=
cord
> you want as the OpenArg... in the Open event of the detail form, use the
> recordset bookmark to make the said ID current. =A0For this example we'll
> pretend you have a numeric ID:
>
> Private Sub Form_Open(Cancel As Integer)
> =A0 Dim lID As Long
> =A0 lID =3D Clng(Me.OpenArgs)
>
> =A0 With Me.RecordsetClone
> =A0 =A0 .FindFirst "[IDField] =3D " & lID
> =A0 =A0 If .NoMatch Then
> =A0 =A0 =A0 MsgBox "Record Not Found!"
> =A0 =A0 Else
> =A0 =A0 =A0 Me.Bookmark =3D .Bookmark
> =A0 =A0 End If
> =A0 End With
>
> End Sub
>
> hth
> --
> Jack Leachwww.tristatemachine.com
>
> "I haven''t failed, I''ve found ten thousand ways that don''t work." =A0
> -Thomas Edison (1847-1931)
>
>
>
> "Cpthooker" wrote:
> > I have been pulling my hair out trying to figure out how to pull this
> > off, what I have is a list of the records in the database and a way to
> > open the detailed form showing more data. But when I used the wizard
> > to make the command button it prevents me from changing the record in
> > the detailed form as it is locked onto the choosen record which is no
> > good as I want the user to be able to pick another record. What is the
> > best way to pull this off?
> > .- Hide quoted text -
>
> - Show quoted text -

Sorry but its not working I have changed what I thought needed to be
changed to match my db, but when I click on the command button it
brings up an error saying 'Invalid use of null'

This is what I am using for the command button to get onto the form

Private Sub Command129_Click()
On Error GoTo Err_Command129_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName =3D "LeafletDetail"

    stLinkCriteria =3D "[LeafletID]=3D" & Me![LeafletID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command129_Click:
    Exit Sub

Err_Command129_Click:
    MsgBox Err.Description
    Resume Exit_Command129_Click

End Sub


and this is the code on the opening form

Private Sub Form_Open(Cancel As Integer)
  Dim lID As Long
  LeafletID =3D CLng(Me.LeafletID)


  With Me.RecordsetClone
    .FindFirst "[LeafletID] =3D " & LeafletID
    If .NoMatch Then
      MsgBox "Record Not Found!"
    Else
      Me.Bookmark =3D .Bookmark
    End If
  End With

End Sub

Maybe you can see something I missed
0
Cpthooker
3/16/2010 3:17:17 PM
Let's take a closer look at the line you're using to open the form...

DoCmd.OpenForm stDocName, , , stLinkCriteria

if you type DoCmd.OpenForm into the VBA editor, followed by a space, you 
will see a list of arguments brought up by intellisense... these are various 
options, or parameters (or however you want to think of them, but they are 
actually called arguments), that you can pass to dictate some base properties 
of the form that is being opened...

DoCmd.OpenForm FormName, View, Filter, Where, Datamode, Windowmode, OpenArgs

FormName: self explanitory (should be!)
View: see dropdown list of options
Filter: Filters the form records to whatever criteria you pass
Where: Restrics records by whatever criteria you pass
Datamode: see dropdown, probably nothing to worry about for now
Windowmode: see Datamode description
OpenArgs: any misc values you want to pass to the form

Filter vs Where Clause:  Say you're opening a form with 10k records... a 
filter will load all 10k records even if the filter will only show 3 of them. 
 A Where clause, on the other hand, will only load the 3 records rather than 
all 10k.  Hence, using a Where clause is much more efficient, and filter's 
should only be used at a specific need...

The boilerplate cmd button wizard enters the Form Name into the variable 
stDocName, and a where clause into a variable stLinkCriteria.  So with your 
where clause set to open the form with only a single record, that of which 
has the same ID as what you pass in your criteria.  Therefore, you are 
noticing that none of the other records are accessible.

You could, if you wanted, move this stLinkCriteria to the Filter argument, 
and when you want to show records in the popup form, use the following line 
to turn the filter off:

Me.FilterOn = False

However, this requires a bit more code than necessary for your purposes.  To 
do what you want, the general method is to pass the ID as an OpenArg (misc 
data for the form), and read the OpenArg when the form opens, and navigate as 
required.

The reason you are getting the invalid use of null error when opening the 
form is because no information is being passed as an OpenArg (and therefore 
Me.OpenArgs in the form is Null).

Basically, you want to leave the Where argument blank (so the records aren't 
restricted), and move that ID to the OpenArgs argument.  Also, you can get 
rid of those two variables that are needlessly supplied by the wizard... the 
finished product will look like this:

Private Sub Command129_Click()
On Error GoTo Err_Command129_Click

  DoCmd.OpenForm "LeafletDetail", , , , , CStr(Me![LeafletID])

Exit_Command129_Click:
  Exit Sub
Err_Command129_Click:
  etc etc
End Sub


Note that OpenArgs takes a String (text) data, rather than a number.  We use 
CStr() to convert the number to a string, and on the other side, will use 
CLng() to convert that string back to a number.


next...


> 
> Private Sub Form_Open(Cancel As Integer)
>   Dim lID As Long
>   LeafletID = CLng(Me.LeafletID)   
> 
> 
>   With Me.RecordsetClone
>     .FindFirst "[LeafletID] = " & LeafletID
>     If .NoMatch Then
>       MsgBox "Record Not Found!"
>     Else
>       Me.Bookmark = .Bookmark
>     End If
>   End With
> 
> End Sub






>   Dim lID As Long
>   LeafletID = CLng(Me.LeafletID)   

instead of using LeafletID = CLng(Me.LeafletID), you want:

lID = CLng(Me.OpenArgs)


You are not yet working with the LeafletID of this form (Me.LeafletID), and 
using a variable name that is the same as a field or control name is never a 
good idea.

>     .FindFirst "[LeafletID] = " & LeafletID

again, LeafletID is not a good variable name, IMO.  Change this line to:

..FindFirst "LeafletID = " & lID



(side note: square brackets around field/table/form names are only required 
if you use spaces in your names, which is supposed to be avoided)


Those few minor corrections should work... hopefully the drawn out 
explanation will give you WHY it works.


One more additional note...

Checking for Nulls in OpenArgs (or anything else):

If Len(Nz(Me.OpenArgs, "")) = 0 Then
  Cancel = True 'close form if no openargs supplied
End If

Check the VBA help on Len() and Nz() functions and you should be able to 
figure out what's going on there.  The above example will prevent the error 
from raising and subsequently close the form if no OpenArg is supplied.


hth

-- 
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."  
-Thomas Edison (1847-1931) 



"Cpthooker" wrote:

> On Mar 16, 2:24 pm, Jack Leach <dymondjack at hot mail dot com> wrote:
> > Open the form without supplying a where clause, and pass the ID of the record
> > you want as the OpenArg... in the Open event of the detail form, use the
> > recordset bookmark to make the said ID current.  For this example we'll
> > pretend you have a numeric ID:
> >
> > Private Sub Form_Open(Cancel As Integer)
> >   Dim lID As Long
> >   lID = Clng(Me.OpenArgs)
> >
> >   With Me.RecordsetClone
> >     .FindFirst "[IDField] = " & lID
> >     If .NoMatch Then
> >       MsgBox "Record Not Found!"
> >     Else
> >       Me.Bookmark = .Bookmark
> >     End If
> >   End With
> >
> > End Sub
> >
> > hth
> > --
> > Jack Leachwww.tristatemachine.com
> >
> > "I haven''t failed, I''ve found ten thousand ways that don''t work."  
> > -Thomas Edison (1847-1931)
> >
> >
> >
> > "Cpthooker" wrote:
> > > I have been pulling my hair out trying to figure out how to pull this
> > > off, what I have is a list of the records in the database and a way to
> > > open the detailed form showing more data. But when I used the wizard
> > > to make the command button it prevents me from changing the record in
> > > the detailed form as it is locked onto the choosen record which is no
> > > good as I want the user to be able to pick another record. What is the
> > > best way to pull this off?
> > > .- Hide quoted text -
> >
> > - Show quoted text -
> 
> Sorry but its not working I have changed what I thought needed to be
> changed to match my db, but when I click on the command button it
> brings up an error saying 'Invalid use of null'
> 
> This is what I am using for the command button to get onto the form
> 
> Private Sub Command129_Click()
> On Error GoTo Err_Command129_Click
> 
>     Dim stDocName As String
>     Dim stLinkCriteria As String
> 
>     stDocName = "LeafletDetail"
> 
>     stLinkCriteria = "[LeafletID]=" & Me![LeafletID]
>     DoCmd.OpenForm stDocName, , , stLinkCriteria
> 
> Exit_Command129_Click:
>     Exit Sub
> 
> Err_Command129_Click:
>     MsgBox Err.Description
>     Resume Exit_Command129_Click
> 
> End Sub
> 
> 
> and this is the code on the opening form
> 
> Private Sub Form_Open(Cancel As Integer)
>   Dim lID As Long
>   LeafletID = CLng(Me.LeafletID)
> 
> 
>   With Me.RecordsetClone
>     .FindFirst "[LeafletID] = " & LeafletID
>     If .NoMatch Then
>       MsgBox "Record Not Found!"
>     Else
>       Me.Bookmark = .Bookmark
>     End If
>   End With
> 
> End Sub
> 
> Maybe you can see something I missed
> .
> 
0
Utf
3/16/2010 4:37:01 PM
On Mar 16, 4:37=A0pm, Jack Leach <dymondjack at hot mail dot com> wrote:
> Let's take a closer look at the line you're using to open the form...
>
> DoCmd.OpenForm stDocName, , , stLinkCriteria
>
> if you type DoCmd.OpenForm into the VBA editor, followed by a space, you
> will see a list of arguments brought up by intellisense... these are vari=
ous
> options, or parameters (or however you want to think of them, but they ar=
e
> actually called arguments), that you can pass to dictate some base proper=
ties
> of the form that is being opened...
>
> DoCmd.OpenForm FormName, View, Filter, Where, Datamode, Windowmode, OpenA=
rgs
>
> FormName: self explanitory (should be!)
> View: see dropdown list of options
> Filter: Filters the form records to whatever criteria you pass
> Where: Restrics records by whatever criteria you pass
> Datamode: see dropdown, probably nothing to worry about for now
> Windowmode: see Datamode description
> OpenArgs: any misc values you want to pass to the form
>
> Filter vs Where Clause: =A0Say you're opening a form with 10k records... =
a
> filter will load all 10k records even if the filter will only show 3 of t=
hem.
> =A0A Where clause, on the other hand, will only load the 3 records rather=
 than
> all 10k. =A0Hence, using a Where clause is much more efficient, and filte=
r's
> should only be used at a specific need...
>
> The boilerplate cmd button wizard enters the Form Name into the variable
> stDocName, and a where clause into a variable stLinkCriteria. =A0So with =
your
> where clause set to open the form with only a single record, that of whic=
h
> has the same ID as what you pass in your criteria. =A0Therefore, you are
> noticing that none of the other records are accessible.
>
> You could, if you wanted, move this stLinkCriteria to the Filter argument=
,
> and when you want to show records in the popup form, use the following li=
ne
> to turn the filter off:
>
> Me.FilterOn =3D False
>
> However, this requires a bit more code than necessary for your purposes. =
=A0To
> do what you want, the general method is to pass the ID as an OpenArg (mis=
c
> data for the form), and read the OpenArg when the form opens, and navigat=
e as
> required.
>
> The reason you are getting the invalid use of null error when opening the
> form is because no information is being passed as an OpenArg (and therefo=
re
> Me.OpenArgs in the form is Null).
>
> Basically, you want to leave the Where argument blank (so the records are=
n't
> restricted), and move that ID to the OpenArgs argument. =A0Also, you can =
get
> rid of those two variables that are needlessly supplied by the wizard... =
the
> finished product will look like this:
>
> Private Sub Command129_Click()
> On Error GoTo Err_Command129_Click
>
> =A0 DoCmd.OpenForm "LeafletDetail", , , , , CStr(Me![LeafletID])
>
> Exit_Command129_Click:
> =A0 Exit Sub
> Err_Command129_Click:
> =A0 etc etc
> End Sub
>
> Note that OpenArgs takes a String (text) data, rather than a number. =A0W=
e use
> CStr() to convert the number to a string, and on the other side, will use
> CLng() to convert that string back to a number.
>
> next...
>
>
>
>
>
>
>
> > Private Sub Form_Open(Cancel As Integer)
> > =A0 Dim lID As Long
> > =A0 LeafletID =3D CLng(Me.LeafletID) =A0
>
> > =A0 With Me.RecordsetClone
> > =A0 =A0 .FindFirst "[LeafletID] =3D " & LeafletID
> > =A0 =A0 If .NoMatch Then
> > =A0 =A0 =A0 MsgBox "Record Not Found!"
> > =A0 =A0 Else
> > =A0 =A0 =A0 Me.Bookmark =3D .Bookmark
> > =A0 =A0 End If
> > =A0 End With
>
> > End Sub
> > =A0 Dim lID As Long
> > =A0 LeafletID =3D CLng(Me.LeafletID) =A0
>
> instead of using LeafletID =3D CLng(Me.LeafletID), you want:
>
> lID =3D CLng(Me.OpenArgs)
>
> You are not yet working with the LeafletID of this form (Me.LeafletID), a=
nd
> using a variable name that is the same as a field or control name is neve=
r a
> good idea.
>
> > =A0 =A0 .FindFirst "[LeafletID] =3D " & LeafletID
>
> again, LeafletID is not a good variable name, IMO. =A0Change this line to=
:
>
> .FindFirst "LeafletID =3D " & lID
>
> (side note: square brackets around field/table/form names are only requir=
ed
> if you use spaces in your names, which is supposed to be avoided)
>
> Those few minor corrections should work... hopefully the drawn out
> explanation will give you WHY it works.
>
> One more additional note...
>
> Checking for Nulls in OpenArgs (or anything else):
>
> If Len(Nz(Me.OpenArgs, "")) =3D 0 Then
> =A0 Cancel =3D True 'close form if no openargs supplied
> End If
>
> Check the VBA help on Len() and Nz() functions and you should be able to
> figure out what's going on there. =A0The above example will prevent the e=
rror
> from raising and subsequently close the form if no OpenArg is supplied.
>
> hth
>
> --
> Jack Leachwww.tristatemachine.com
>
> "I haven''t failed, I''ve found ten thousand ways that don''t work." =A0
> -Thomas Edison (1847-1931)
>
>
>
> "Cpthooker" wrote:
> > On Mar 16, 2:24 pm, Jack Leach <dymondjack at hot mail dot com> wrote:
> > > Open the form without supplying a where clause, and pass the ID of th=
e record
> > > you want as the OpenArg... in the Open event of the detail form, use =
the
> > > recordset bookmark to make the said ID current. =A0For this example w=
e'll
> > > pretend you have a numeric ID:
>
> > > Private Sub Form_Open(Cancel As Integer)
> > > =A0 Dim lID As Long
> > > =A0 lID =3D Clng(Me.OpenArgs)
>
> > > =A0 With Me.RecordsetClone
> > > =A0 =A0 .FindFirst "[IDField] =3D " & lID
> > > =A0 =A0 If .NoMatch Then
> > > =A0 =A0 =A0 MsgBox "Record Not Found!"
> > > =A0 =A0 Else
> > > =A0 =A0 =A0 Me.Bookmark =3D .Bookmark
> > > =A0 =A0 End If
> > > =A0 End With
>
> > > End Sub
>
> > > hth
> > > --
> > > Jack Leachwww.tristatemachine.com
>
> > > "I haven''t failed, I''ve found ten thousand ways that don''t work." =
=A0
> > > -Thomas Edison (1847-1931)
>
> > > "Cpthooker" wrote:
> > > > I have been pulling my hair out trying to figure out how to pull th=
is
> > > > off, what I have is a list of the records in the database and a way=
 to
> > > > open the detailed form showing more data. But when I used the wizar=
d
> > > > to make the command button it prevents me from changing the record =
in
> > > > the detailed form as it is locked onto the choosen record which is =
no
> > > > good as I want the user to be able to pick another record. What is =
the
> > > > best way to pull this off?
> > > > .- Hide quoted text -
>
> > > - Show quoted text -
>
> > Sorry but its not working I have changed what I thought needed to be
> > changed to match my db, but when I click on the command button it
> > brings up an error saying 'Invalid use of null'
>
> > This is what I am using for the command button to get onto the form
>
> > Private Sub Command129_Click()
> > On Error GoTo Err_Command129_Click
>
> > =A0 =A0 Dim stDocName As String
> > =A0 =A0 Dim stLinkCriteria As String
>
> > =A0 =A0 stDocName =3D "LeafletDetail"
>
> > =A0 =A0 stLinkCriteria =3D "[LeafletID]=3D" & Me![LeafletID]
> > =A0 =A0 DoCmd.OpenForm stDocName, , , stLinkCriteria
>
> > Exit_Command129_Click:
> > =A0 =A0 Exit Sub
>
> > Err_Command129_Click:
> > =A0 =A0 MsgBox Err.Description
> > =A0 =A0 Resume Exit_Command129_Click
>
> > End Sub
>
> > and this is the code on the opening form
>
> > Private Sub Form_Open(Cancel As Integer)
> > =A0 Dim lID As Long
> > =A0 LeafletID =3D CLng(Me.LeafletID)
>
> > =A0 With Me.RecordsetClone
> > =A0 =A0 .FindFirst "[LeafletID] =3D " & LeafletID
> > =A0 =A0 If .NoMatch Then
> > =A0 =A0 =A0 MsgBox "Record Not Found!"
> > =A0 =A0 Else
> > =A0 =A0 =A0 Me.Bookmark =3D .Bookmark
> > =A0 =A0 End If
> > =A0 End With
>
> > End Sub
>
> > Maybe you can see something I missed
> > .- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Its still saying there is a null value, would you be able to look at
the db as I have looked to see what is wrong but cannot see it, I am
useless on VBA
0
Cpthooker
3/17/2010 9:29:11 AM
Can you tell me what line in particular the error is happening at?  When you 
get the message press Ctrl+Break and the code window should come up with the 
line highlighted.

It sounds as though you may be trying to do this with an empty record (no 
value for the main LeafletID

-- 
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."  
-Thomas Edison (1847-1931) 

0
Utf
3/17/2010 12:48:01 PM
On Mar 17, 12:48=A0pm, Jack Leach <dymondjack at hot mail dot com>
wrote:
> Can you tell me what line in particular the error is happening at? =A0Whe=
n you
> get the message press Ctrl+Break and the code window should come up with =
the
> line highlighted.
>
> It sounds as though you may be trying to do this with an empty record (no
> value for the main LeafletID
>
> --
> Jack Leachwww.tristatemachine.com
>
> "I haven''t failed, I''ve found ten thousand ways that don''t work." =A0
> -Thomas Edison (1847-1931)

lID =3D CLng(Me.OpenArgs)
0
Cpthooker
3/17/2010 12:55:52 PM
This is what i put on the form for the filter to be removed

Private Sub Form_Open(Cancel As Integer)
  Dim lID As Long
  lID = CLng(Me.OpenArgs)


  With Me.RecordsetClone
    .FindFirst "LeafletID = " & lID
    If .NoMatch Then
      MsgBox "Record Not Found!"
    Else
      Me.Bookmark = .Bookmark
    End If
  End With
  If Len(Nz(Me.OpenArgs, "")) = 0 Then
  Cancel = True 'close form if no openargs supplied
  End If
End Sub

is this right?
0
Cpthooker
3/17/2010 3:27:13 PM
This means that the OpenArgs are not being sent correctly... did you supply 
an argument for OpenArgs in the DoCmd.OpenForm line?  Can you post that like 
of the code please...


-- 
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."  
-Thomas Edison (1847-1931) 



"Cpthooker" wrote:

> On Mar 17, 12:48 pm, Jack Leach <dymondjack at hot mail dot com>
> wrote:
> > Can you tell me what line in particular the error is happening at?  When you
> > get the message press Ctrl+Break and the code window should come up with the
> > line highlighted.
> >
> > It sounds as though you may be trying to do this with an empty record (no
> > value for the main LeafletID
> >
> > --
> > Jack Leachwww.tristatemachine.com
> >
> > "I haven''t failed, I''ve found ten thousand ways that don''t work."  
> > -Thomas Edison (1847-1931)
> 
> lID = CLng(Me.OpenArgs)
> .
> 
0
Utf
3/17/2010 3:44:01 PM
You mean the button to open the form?

Private Sub Command129_Click()
On Error GoTo Err_Command129_Click

    DoCmd.OpenForm "LeafletDetail", , , , , CStr(Me![LeafletID])

Exit_Command129_Click:
    Exit Sub

Err_Command129_Click:
    MsgBox Err.Description
    Resume Exit_Command129_Click

End Sub

On Mar 17, 3:44=A0pm, Jack Leach <dymondjack at hot mail dot com> wrote:
> This means that the OpenArgs are not being sent correctly... did you supp=
ly
> an argument for OpenArgs in the DoCmd.OpenForm line? =A0Can you post that=
 like
> of the code please...
>
> --
> Jack Leachwww.tristatemachine.com
>
> "I haven''t failed, I''ve found ten thousand ways that don''t work." =A0
> -Thomas Edison (1847-1931)
>
>
>
> "Cpthooker" wrote:
> > On Mar 17, 12:48 pm, Jack Leach <dymondjack at hot mail dot com>
> > wrote:
> > > Can you tell me what line in particular the error is happening at? =
=A0When you
> > > get the message press Ctrl+Break and the code window should come up w=
ith the
> > > line highlighted.
>
> > > It sounds as though you may be trying to do this with an empty record=
 (no
> > > value for the main LeafletID
>
> > > --
> > > Jack Leachwww.tristatemachine.com
>
> > > "I haven''t failed, I''ve found ten thousand ways that don''t work." =
=A0
> > > -Thomas Edison (1847-1931)
>
> > lID =3D CLng(Me.OpenArgs)
> > .- Hide quoted text -
>
> - Show quoted text -

0
Cpthooker
3/17/2010 3:52:45 PM
Sorry I haven't gotten back, been a hectic few days, didn't mean to leave you 
hanging.  Send an email of the file if you like, stripped down with only the 
objects required to demonstrate the problem and a handful of records.  
Version 2003 or before, I don't run 2007

dymondjack at hot mail com
-- 
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."  
-Thomas Edison (1847-1931) 



"Cpthooker" wrote:

> You mean the button to open the form?
> 
> Private Sub Command129_Click()
> On Error GoTo Err_Command129_Click
> 
>     DoCmd.OpenForm "LeafletDetail", , , , , CStr(Me![LeafletID])
> 
> Exit_Command129_Click:
>     Exit Sub
> 
> Err_Command129_Click:
>     MsgBox Err.Description
>     Resume Exit_Command129_Click
> 
> End Sub
> 
> On Mar 17, 3:44 pm, Jack Leach <dymondjack at hot mail dot com> wrote:
> > This means that the OpenArgs are not being sent correctly... did you supply
> > an argument for OpenArgs in the DoCmd.OpenForm line?  Can you post that like
> > of the code please...
> >
> > --
> > Jack Leachwww.tristatemachine.com
> >
> > "I haven''t failed, I''ve found ten thousand ways that don''t work."  
> > -Thomas Edison (1847-1931)
> >
> >
> >
> > "Cpthooker" wrote:
> > > On Mar 17, 12:48 pm, Jack Leach <dymondjack at hot mail dot com>
> > > wrote:
> > > > Can you tell me what line in particular the error is happening at?  When you
> > > > get the message press Ctrl+Break and the code window should come up with the
> > > > line highlighted.
> >
> > > > It sounds as though you may be trying to do this with an empty record (no
> > > > value for the main LeafletID
> >
> > > > --
> > > > Jack Leachwww.tristatemachine.com
> >
> > > > "I haven''t failed, I''ve found ten thousand ways that don''t work."  
> > > > -Thomas Edison (1847-1931)
> >
> > > lID = CLng(Me.OpenArgs)
> > > .- Hide quoted text -
> >
> > - Show quoted text -
> 
> .
> 
0
Utf
3/19/2010 9:01:02 AM
Sent the file, thanks for your help
0
Cpthooker
3/19/2010 10:13:02 AM
Reply:

Similar Artilces:

WIN X Sp2 IE8.0 killed by CPXRSYSGUARD.EXE and or ? Cant get IE8 to access the web
Tonite, I Contracted 39 versions of what SuperAntiSpyware calls: ROGUE.AGENT/GEN in my Registry HKUS\S-1-5-21 (see below) etc (in 39 different file endings) and TROJAN.AGENT/GEN-FakeSpy[Broad] 3 copies 1. in HKUS\S-1-5-21-2952124706-32014773-2762605872-1007Software\Microsoft\Windows\CurrentVersion\Run(jdfecxfs- C:\Documentsand Settings\Alan\LocalSettings\ApplicationData\ubqllk\cpxrsysguard.exe and The other two in C:\ DocSettings\Alan\LocalSettings\ApplicationData where it again opened a Folder named UBQLLK and inserted 2 copies of CPXRSYSGUARD.EXE It beg...

excel to get data from an access database
I need excel to get data from an access database similar to vlookup function from an excel table. In order to have only specific records copied to your Excel file, the query needs to include selection criteria (and sort order if necessary). Otherwise, all records get copied and you then need to create lookup formulas or use filters to restrict the set of record. If you are not familiar with Access queries, have someone who is create one for you as a stored query object in the database file. You can then use the Data>Import (Get) External Data and choose the query as your record sour...

when i open an attachment it just shows a box i cannot open
Attachment, whether docs or pictures won't open. I can preview them inside the window pane, but then have to copy to word doc to print. Should be able to open attachment and then print just from there. Please help. It's like the Microsoft Picture manager is working strangely. ...

code to allow edits in form AND subform
Ok, here goes............. I have a form (frmBOL) which contains a subform (sfrmData). I have this code working to allow the form to be edited, but I can't seem to incorporate the subform into it. Everything I try gives me an error. Can anyone help? Private Sub cmdOK_Click() Dim sPassword As String sPassword = Nz(Me.txtPassword.Value, "") ' if it is a valid password, we let them edit the ' form that called this form. The calling form is ' responsible for check that the current user is ' either the QA tech on the record, or a me...

After sharepoint3 import from sp2, DNS records incorret?
Hello We have imported site to Sharepoint 3.0 (SBS2008) from Sharepoint 2. Now there are some strange occasional DNS lookup errors. Some pages fail to open but next time there is no problem opening the same page. DNS is running on the same local server where Sharepoint. Both have the same IP in fact.. With nslookup from workstation I noticed that "mycompanyweb" is resolved correctly while "http:/mycomanyweb" fails. 1. Might there be some (http:// prefix) missing in DNS server? 2. When there is a subsite "mycompanyweb/mydepartment", do we need ...

POP
Hello all, we have an issue where a PO was created with 4 line items and line item number 1 was not adding into the total on the report not the form which we did not know at the time.. then we had to edit line line 2 which at that time they noticed that the report was short still the line item #1 but the PO entry form showed the correct amount... I look into the tables and all seemed to be correct so it's just the report itself that is showing the incorrect amount.... any help would be great Hi Bam. See if the report itself has been customized. If it is, it could be a bug on the c...

Skip Records in a Form
I have a form in my database based on a table. The table is appended with new reocrds everyday. My goal is to have the form present only the new records and allow a user to key data into the new record and be recorded in the same table. The issue I have is that the form is displaying all records not just the new. Does anyone know a way to open a form and display only those records that have not been updated by the user? Thanks in advance Add a column for UpdateDate and update this column whenever a record is updated via the form. Set up a query to read all the rows/columns ...

Opening a paramater form when open a report
I have a repor that takes date parameters from a seperate form.. As it is now I have to open the form put in the paramaters and then run the report which is based on a query... I would like to have the form pop up when I open the report and then close once once the report has run.. Help Please And thanks in advance bob On Wed, 15 Aug 2007 11:56:00 -0700, Bob wrote: > I have a repor that takes date parameters from a seperate form.. As it is now > I have to open the form put in the paramaters and then run the report which > is based on a query... > > I would like to ...

How do I get my MS Pub 2000 to open Pub files from Pub 2003?
i cannot get my Publisher 2000 to open files from Pub 2003....do i have to buy Pub 2003? or is there a solution that I can download? I have already disabled my antivirus and that didn't do anything.. also my files are not "read only". pls help. thx. Novice Novice <Novice@discussions.microsoft.com> was very recently heard to utter: > i cannot get my Publisher 2000 to open files from Pub 2003....do i > have to buy Pub 2003? or is there a solution that I can download? I > have already disabled my antivirus and that didn't do anything.. also > my files ...

Export from and Import to Access
We are creating an issues tracking database using Access 2003 and would like to export information to management, obtain their feedback and update the database on a periodic basis. What is the best process for doing this? Would Access 2007 make this process easier somehow? -- gsr Per srichards: >We are creating an issues tracking database using Access 2003 and would like >to export information to management, obtain their feedback and update the >database on a periodic basis. What is the best process for doing this? >Would Access 2007 make this process easier somehow? D...

Publisher 2000
After I open the Publisher 2000 program and attempt to open a file or create a new document, I get the message "Microsoft Publisher 2000 Version 6.0 has encoountered a problem and needs to close. WE are sorry for the inconvenience". I tried repairing the program and even reinstalling it, but that did not correct it. Suggestions? If you are trying to use Publisher on a network - don't it is not intended for a network Publisher files have to be worked on and saved to the local hard drive ONLY. -- Hi tom (tevanz@bellsouth.net), in the Microsoft� newsgroups you posted: ...

opening links in outlook
why i can not open links attached to my e-mails mike wrote: >why i can not open links attached to my e-mails > I think you did some mistake in typing so just do one thing first type the link in notepad and then direct copy and paste that in your mail. -- Stellar Information Systems Ltd. D18, Sector-33, Infocity Phase II, Gurgaon-122001 Phone : (0124) 326 6069, 432 6700 Website : http://www.stellarinfo.co.in/ What happens when you try? Do you get the error; "This operation has been cancelled due to restrictions in effect on this computer" See http://www.m...

Restarting Record Count in a Query
Hello, I have a query that returns these results for me: Badge No DepLastName DepFirstName 11111 Smith Mary 11111 Smith Joe 22222 Brown Bill 22222 Brown Mary 22222 Brown Jack I need to count the dependents that are linked to each Badge No so my results look like this Badge No Count DepLastName DepFirstName 11111 1 Smith Mary 11111 2 Smith Joe 22222 1 Brown Bill 22222 2 ...

Problem trying to open old money file
Hi, I am trying to open a four-month old money file, which was on my backup disk. It is a *.mny file, not a backup file. It was created using the same version of Money (2005) which I still use. When I start MS MONEY and try open my old data file, it tells my that it wants convert my file so it works with this version. (Not sure why as the file was created in this version of MS Money). Then when I try and carry out the conversion it gives the following error message. "Money cannot locate xxxx or cannot open it, possibly because it is a read-only file or you do not have...

Running Virus Scan Slowing down opening files
3 minutes to open files in excel and word Are you using kaspersky virusscan? It is know for it. If yes please ask you administrator to exclude scan on harddisk or network files in the settings. -- Arien ------------------------------------------------------------------------ Arien's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1892 View this thread: http://www.excelforum.com/showthread.php?threadid=390878 All Virus Scanning can be stopped: If your using Norton Follow the below if you want to open documents much faster Open Norton Click on: Norton Interne...

Email with tiny attachments open slow
Good Day All, I am using Exchange server 200 and Outlook 2003 mail client. I have started to experience with a single machine where all of a sudden reading emails with attachments of any size, even 6k, slows greatly. Just selecting the email item in the list takes at least 30 seconds before the lower pane shows the body of the selected item. No other client has the same problem even while this machine does. The problem seems to disappear at some point and then returns. The machine was connected to a 10Mbps switch so I changed to a 100Mbps switch and Event logs reveal nothing. I have ...

Need an open house sign in sheet
Need an open house sign in sheet That's interesting, but do you have a question about Publisher? -- James Bart: "According to creationism, there were no cavemen." Homer: "Well good riddance, their drawings sucked and they all looked like hippies!" "soozeeque" <soozeeque@discussions.microsoft.com> wrote in message news:1096B15B-9766-4573-9FC2-2053BEC1F34B@microsoft.com... > Need an open house sign in sheet I would suggest keeping it simple. Use a table for the visitors' information and maybe your real estate company's logo...

Converting Access 2000 to Access 2003 or XP
I have Access 2000 on my home PC and want to install it on my business PC. I also need to upgrade this program. Do I upgrade first, then bring it to work? Also, if the software is licensed to me at home, can I install it on my business computer as well? Thank you. No, each install has to have its own separate license. The Access 2000 on your home PC is only licensed for you home PC. If you are planning to upgrade, you would be better off buying the full installation of Office 2003 or Office 2002 to install on your business machine. If installing Office 2002/2003 to more than one machin...

Table to form
I have a field in a table called ID. 4 posititions. I have a field in a subform where I want to enter an ID. If the ID is not in the table, I want to know. How can I connect them? By the way, if it is not in the table, I would want a message to pop up or the ability to add to the table on the fly. Thanks. On Fri, 29 Jun 2007 10:36:25 -0500, "rob peterson" <buster@owc.net> wrote: >I have a field in a table called ID. 4 posititions. What do you mean by "positions"?? >I have a field in a subform where I want to enter an ID. If the ID is not in >the tabl...

cannot open excel file from outlook
Excel 2007 cannot open document eithout first saving and opening thru excel Try to re-register Excel. Close Excel first and On the Windows Taskbar Start>Run "excel.exe /regserver"(no quotes)>OK. See the space between exe and /regserver You might have to designate a full path to excel.exe. In that case Start>Run "C:\yourpath\excel.exe" /regserver(quotes required)>OK Gord Dibben MS Excel MVP On Wed, 27 Jan 2010 11:38:12 -0800, Rick <Rick@discussions.microsoft.com> wrote: >Excel 2007 cannot open document eithout first savi...

opening links
Whenever I try to open a link in Outlook XP -- (Win XP Pro) it opens a "open with" prompt/box. Point it to the .exe for your preferred browser and click okay. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the Swen virus, all e-mails sent to my actual account will be deleted w/out reading. After searching google.groups.com and finding no answer anonymous@discussions.microsoft.com <anonymous@discussions.microsoft.com> asked: | Whenever I try to open a link in Outlook XP -- (Win XP | Pro) it opens a "open with&quo...

recording asset loan extra payments
How do I record and track an asset loan in Money 2002 when an extra payment amount is given(each month, our land payment check is for $1.02 more than it should be.) You create a loan account and setup a loan payment. Then you edit the splits of the loan payment and add a line for an extra Principal Transfer (that's the "category") of the $1.02. "Katy" <db0008@dragonbbs.com> wrote in message news:092701c38f72$1f31ffc0$a001280a@phx.gbl... > How do I record and track an asset loan in Money 2002 > when an extra payment amount is given(each month, our > l...

unable to open your default mail folders...
I am running XP Pro and Office XP 2002. I currently use Outlook express on this PC but want to switch over to Outlook. When I try to open Outlook I get the message- Unable to open your default mail folders. Could not open item. Try again. Any ideas what's going on ??? Thanks in advance!!! -- Dennis Have you created a mail profile and installed your mail account(s)? -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. ALWAYS post your Outlook version. How to ask a question: http://support.microsoft.com/KB/555375 After furious head scrat...

Workbook always opens at a specific sheet and cell
I have a workbook consisting of many sheets. How do I make sure that everytime I open the work book, it would directly point to a specific sheet and cell? Hi put the following code in your workbook module (not in a standard module). sub workbook_open() me.worksheets("sheetx").activate end sub -- Regards Frank Kabel Frankfurt, Germany Zee wrote: > I have a workbook consisting of many sheets. How do I make sure that > everytime I open the work book, it would directly point to a specific > sheet and cell? methinks the original poster also wanted to activate a particu...

EXCEL Files open Slow
Why is it that when I open associated files for Office 2007 (.xlsx and ..docx) that they open SLOW (approx 15 seconds). However, if I have Excel or Word open and then attempt to open specific files, they open in a snap ? I have Office 2007, Vista Home Prsmium, a 2.4 Quad Core system, and four gigs of ram. Can someone please explain this and help me out ? Thanks. Hi, If I get your point - when you open the files in the Window Explorer (outside of Excel) it takes longer. Sometimes that if because Excel needs to launch, and that can be slower than just opening a file from inside of Excel...