Docmd.FindRecord not working when filtered

C

Chaddy

I have a DB that users access pages via Allen Browne's search screen (Thank
god for this! I was having troubles getting a keyword search to work)
When users click on a result it comes up as filtered (record 1 of 1).
However on my form there is a text field that the user can click on to take
them to another record thats of a similar topic to the record they are
currently using.

The below works when all records are 'viewable' but not when the user has
selected the record from the search screen.
DoCmd.GoToControl "Field1"
DoCmd.FindRecord Field2

Any help appreciated.
 
A

Allen Browne

It makes sense that if the record you want is filtered out of the form, it
will not be found.

If you wish to remove the filter so the record can be found, add this line
above your code:
If Me.FilterOn Then Me.FilterOn = False
 
C

Chaddy

Thanks Allen,

I have tried that and it doesn't work as soon as the filter is removed the
form goes back to record 1 and it then doesn't know what was entered in
Feild2 on the record that was being viewed (some records don't have anything
in this field, others have the name of another record with a similar topic)

Does this make sense??? Sometimes I tend to confuse myself!!
 
A

Allen Browne

Not sure I understand what you are doing here.

Is Field2 *unbound*? If so, you are not entering a value to save, merely a
value to find.

Or is Field2 *bound* to a field? If so, entering something will save to that
field - proabaly not what you intend. Trying to use the one box to filter
and enter data is likely to lead to confusion.

Or are you using Filter By Form or some other mode?

Or are you trying to use Filter By Selection?

Applying or removing a filter will have the effect of loading the form
again, and hence moving to the first record.
 
C

Chaddy

Sorry Allen,
Thanks for your help, this is the last bug in my database!!

The database is being used as a procedure manual of sorts for electricity
faults. Users do not edit or load info (Only a Supervisor can add/edit info
and this is done through another form).
They search a topic, say Damaged Street lights.
This appears on the form in Field 1 [Title] along with relevant info.
One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
On many records [LinkedInfo] may be empty (no other pages with relevant info
to the record being viewed) However, some pages may have the title to another
record (in the example above "Installing New Street Lights".

Therefore when viewing the Damaged Street Lights record and the user clicks
[LinkedInfo] the record changes now showing [Title] = Installing New Street
Lights (as these two records are about the same topic). - Vice versa
"Installing New Street Lights" has "Damaged Street Lights" appearing in its
[LinkedInfo] field.

I may have set this up wrong so any suggestions would be appreciated.
 
A

Allen Browne

Use an unbound text box for the user to enter the value to find.

If you want to search 2 fields to find the value, you would build the filter
string like this:

If Not IsNull(Me.txtWot2Find) Then
strWhere = strWhere & "(([Title] = """ & Me.txtWot2Find & _
""") OR ([LinkedInfo] = """ & Me.txtWot2Find & """)) AND "
End If

That's assuming you need to use this as part of the utility you referred to
in your original post, which I think is:
http://allenbrowne.com/ser-62.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Chaddy said:
Sorry Allen,
Thanks for your help, this is the last bug in my database!!

The database is being used as a procedure manual of sorts for electricity
faults. Users do not edit or load info (Only a Supervisor can add/edit
info
and this is done through another form).
They search a topic, say Damaged Street lights.
This appears on the form in Field 1 [Title] along with relevant info.
One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
On many records [LinkedInfo] may be empty (no other pages with relevant
info
to the record being viewed) However, some pages may have the title to
another
record (in the example above "Installing New Street Lights".

Therefore when viewing the Damaged Street Lights record and the user
clicks
[LinkedInfo] the record changes now showing [Title] = Installing New
Street
Lights (as these two records are about the same topic). - Vice versa
"Installing New Street Lights" has "Damaged Street Lights" appearing in
its
[LinkedInfo] field.

I may have set this up wrong so any suggestions would be appreciated.

Allen Browne said:
Not sure I understand what you are doing here.

Is Field2 *unbound*? If so, you are not entering a value to save, merely
a
value to find.

Or is Field2 *bound* to a field? If so, entering something will save to
that
field - proabaly not what you intend. Trying to use the one box to filter
and enter data is likely to lead to confusion.

Or are you using Filter By Form or some other mode?

Or are you trying to use Filter By Selection?

Applying or removing a filter will have the effect of loading the form
again, and hence moving to the first record.
 
T

Tucker

Sorry Allen This wasn't quite what I was after/didn't work.
I think you're gonna regret trying to help me!! This email may be long but I
will try to explain the format of my DB.

Users do not enter any info except in your search screen (which works great
- THANKYOU!). This searches a keyword field.(record source is a query based
on Tbl_MainData.
The query for the Search screen only contains:
[RecordID], [Title], [DateLastUpdated], [Status], [Keywords] and [View] .
[View] has a default setting of "Click Here To View" and has a macro (from
On Click) that opens the form Frm_MainForm with the selected RecordID.

The Frm_MainForm then has a record source directly to Tbl_MainData. All
fields on this form are locked and can only be viewed by users. It contains
the fields
[RecordID], [Title], [DateLastUpdated], [Status], [Keywords], [Information],
[ContactPerson], [ContactPhoneNumber], [ApprovedBy] etc, and [LinkedInfo].

These are all bound fields (text boxes, dates etc. No Combos as the form is
for viewing only) back to the table Tbl_MainData

This form has no functions or calculations except a Cmd button to close and
another to bring up your search screen again so the user can search on
another topic. This all works perfectly (As stated before the recordset does
filter as 1 of 1).

The only other 'performance' this form needs to do is with the [LinkedInfo]
field.
Many records will have nothing in this field, others will have the title to
another record when it is of a similar topic. What I want it to do is when
clicked, change the record currently being viewed to the one that was in the
[LinkedInfo] field.

Adding/editing of records is done through another form
(Frm_MainScreenMaint)This has all the fields unlocked and the [LinkedInfo]
field is a Combo box ON THIS FORM linked to [Title], thereby making sure that
data entered matches info appearing in the Title field.

You may need a rest after reading that but hopefully that makes a little
more sense.. Can I do what I want to do????



Allen Browne said:
Use an unbound text box for the user to enter the value to find.

If you want to search 2 fields to find the value, you would build the filter
string like this:

If Not IsNull(Me.txtWot2Find) Then
strWhere = strWhere & "(([Title] = """ & Me.txtWot2Find & _
""") OR ([LinkedInfo] = """ & Me.txtWot2Find & """)) AND "
End If

That's assuming you need to use this as part of the utility you referred to
in your original post, which I think is:
http://allenbrowne.com/ser-62.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Chaddy said:
Sorry Allen,
Thanks for your help, this is the last bug in my database!!

The database is being used as a procedure manual of sorts for electricity
faults. Users do not edit or load info (Only a Supervisor can add/edit
info
and this is done through another form).
They search a topic, say Damaged Street lights.
This appears on the form in Field 1 [Title] along with relevant info.
One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
On many records [LinkedInfo] may be empty (no other pages with relevant
info
to the record being viewed) However, some pages may have the title to
another
record (in the example above "Installing New Street Lights".

Therefore when viewing the Damaged Street Lights record and the user
clicks
[LinkedInfo] the record changes now showing [Title] = Installing New
Street
Lights (as these two records are about the same topic). - Vice versa
"Installing New Street Lights" has "Damaged Street Lights" appearing in
its
[LinkedInfo] field.

I may have set this up wrong so any suggestions would be appreciated.

Allen Browne said:
Not sure I understand what you are doing here.

Is Field2 *unbound*? If so, you are not entering a value to save, merely
a
value to find.

Or is Field2 *bound* to a field? If so, entering something will save to
that
field - proabaly not what you intend. Trying to use the one box to filter
and enter data is likely to lead to confusion.

Or are you using Filter By Form or some other mode?

Or are you trying to use Filter By Selection?

Applying or removing a filter will have the effect of loading the form
again, and hence moving to the first record.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Thanks Allen,

I have tried that and it doesn't work as soon as the filter is removed
the
form goes back to record 1 and it then doesn't know what was entered in
Feild2 on the record that was being viewed (some records don't have
anything
in this field, others have the name of another record with a similar
topic)

Does this make sense??? Sometimes I tend to confuse myself!!

:

It makes sense that if the record you want is filtered out of the
form,
it
will not be found.

If you wish to remove the filter so the record can be found, add this
line
above your code:
If Me.FilterOn Then Me.FilterOn = False

I have a DB that users access pages via Allen Browne's search screen
(Thank
god for this! I was having troubles getting a keyword search to
work)
When users click on a result it comes up as filtered (record 1 of
1).
However on my form there is a text field that the user can click on
to
take
them to another record thats of a similar topic to the record they
are
currently using.

The below works when all records are 'viewable' but not when the
user
has
selected the record from the search screen.
DoCmd.GoToControl "Field1"
DoCmd.FindRecord Field2
 
A

Allen Browne

So LinkedInfo is a Text field in Tbl_MainData, that contains a value that's
supposed to match the contents of the Title field in *one* other record?

Relationally, it would make more sense to me if LinkedInfo was a Number
field that stored the RecordID of the other record. (I'm assuming RecordID
is the primary key.) You can still *display* the Title from that record if
you wish. You would create a query with 2 copies of the same table, with the
numeric LinkedInfoID outer-joined to the RecordID of the other table, and so
you can get the Title of the other record into your form.

If that sounds like it would do the job, post back if you want help on how
to create the self-join (relationship for the table that looks itself up),
the outer join (so the query gives you all records, even if the LinkedInfoID
is null), or the code to find the other RecordID.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Tucker said:
Sorry Allen This wasn't quite what I was after/didn't work.
I think you're gonna regret trying to help me!! This email may be long but
I
will try to explain the format of my DB.

Users do not enter any info except in your search screen (which works
great
- THANKYOU!). This searches a keyword field.(record source is a query
based
on Tbl_MainData.
The query for the Search screen only contains:
[RecordID], [Title], [DateLastUpdated], [Status], [Keywords] and [View] .
[View] has a default setting of "Click Here To View" and has a macro (from
On Click) that opens the form Frm_MainForm with the selected RecordID.

The Frm_MainForm then has a record source directly to Tbl_MainData. All
fields on this form are locked and can only be viewed by users. It
contains
the fields
[RecordID], [Title], [DateLastUpdated], [Status], [Keywords],
[Information],
[ContactPerson], [ContactPhoneNumber], [ApprovedBy] etc, and [LinkedInfo].

These are all bound fields (text boxes, dates etc. No Combos as the form
is
for viewing only) back to the table Tbl_MainData

This form has no functions or calculations except a Cmd button to close
and
another to bring up your search screen again so the user can search on
another topic. This all works perfectly (As stated before the recordset
does
filter as 1 of 1).

The only other 'performance' this form needs to do is with the
[LinkedInfo]
field.
Many records will have nothing in this field, others will have the title
to
another record when it is of a similar topic. What I want it to do is when
clicked, change the record currently being viewed to the one that was in
the
[LinkedInfo] field.

Adding/editing of records is done through another form
(Frm_MainScreenMaint)This has all the fields unlocked and the [LinkedInfo]
field is a Combo box ON THIS FORM linked to [Title], thereby making sure
that
data entered matches info appearing in the Title field.

You may need a rest after reading that but hopefully that makes a little
more sense.. Can I do what I want to do????



Allen Browne said:
Use an unbound text box for the user to enter the value to find.

If you want to search 2 fields to find the value, you would build the
filter
string like this:

If Not IsNull(Me.txtWot2Find) Then
strWhere = strWhere & "(([Title] = """ & Me.txtWot2Find & _
""") OR ([LinkedInfo] = """ & Me.txtWot2Find & """)) AND "
End If

That's assuming you need to use this as part of the utility you referred
to
in your original post, which I think is:
http://allenbrowne.com/ser-62.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Chaddy said:
Sorry Allen,
Thanks for your help, this is the last bug in my database!!

The database is being used as a procedure manual of sorts for
electricity
faults. Users do not edit or load info (Only a Supervisor can add/edit
info
and this is done through another form).
They search a topic, say Damaged Street lights.
This appears on the form in Field 1 [Title] along with relevant info.
One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
On many records [LinkedInfo] may be empty (no other pages with relevant
info
to the record being viewed) However, some pages may have the title to
another
record (in the example above "Installing New Street Lights".

Therefore when viewing the Damaged Street Lights record and the user
clicks
[LinkedInfo] the record changes now showing [Title] = Installing New
Street
Lights (as these two records are about the same topic). - Vice versa
"Installing New Street Lights" has "Damaged Street Lights" appearing in
its
[LinkedInfo] field.

I may have set this up wrong so any suggestions would be appreciated.

:

Not sure I understand what you are doing here.

Is Field2 *unbound*? If so, you are not entering a value to save,
merely
a
value to find.

Or is Field2 *bound* to a field? If so, entering something will save
to
that
field - proabaly not what you intend. Trying to use the one box to
filter
and enter data is likely to lead to confusion.

Or are you using Filter By Form or some other mode?

Or are you trying to use Filter By Selection?

Applying or removing a filter will have the effect of loading the form
again, and hence moving to the first record.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Thanks Allen,

I have tried that and it doesn't work as soon as the filter is
removed
the
form goes back to record 1 and it then doesn't know what was entered
in
Feild2 on the record that was being viewed (some records don't have
anything
in this field, others have the name of another record with a similar
topic)

Does this make sense??? Sometimes I tend to confuse myself!!

:

It makes sense that if the record you want is filtered out of the
form,
it
will not be found.

If you wish to remove the filter so the record can be found, add
this
line
above your code:
If Me.FilterOn Then Me.FilterOn = False

I have a DB that users access pages via Allen Browne's search
screen
(Thank
god for this! I was having troubles getting a keyword search to
work)
When users click on a result it comes up as filtered (record 1 of
1).
However on my form there is a text field that the user can click
on
to
take
them to another record thats of a similar topic to the record
they
are
currently using.

The below works when all records are 'viewable' but not when the
user
has
selected the record from the search screen.
DoCmd.GoToControl "Field1"
DoCmd.FindRecord Field2
 
T

Tucker

Thanks Allen, That sounds great. If you can give me a hand with this I would
appreciate it. I originally tried it this way but couldn't get it to work.

As long as the end product is the user clicks on the field and the record
changes (even though the recordset has filtered to 1 of 1) I'll be a happy
man!!!

Chad.
(Tucker is when I log on from work, Chaddy from home).

Allen Browne said:
So LinkedInfo is a Text field in Tbl_MainData, that contains a value that's
supposed to match the contents of the Title field in *one* other record?

Relationally, it would make more sense to me if LinkedInfo was a Number
field that stored the RecordID of the other record. (I'm assuming RecordID
is the primary key.) You can still *display* the Title from that record if
you wish. You would create a query with 2 copies of the same table, with the
numeric LinkedInfoID outer-joined to the RecordID of the other table, and so
you can get the Title of the other record into your form.

If that sounds like it would do the job, post back if you want help on how
to create the self-join (relationship for the table that looks itself up),
the outer join (so the query gives you all records, even if the LinkedInfoID
is null), or the code to find the other RecordID.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Tucker said:
Sorry Allen This wasn't quite what I was after/didn't work.
I think you're gonna regret trying to help me!! This email may be long but
I
will try to explain the format of my DB.

Users do not enter any info except in your search screen (which works
great
- THANKYOU!). This searches a keyword field.(record source is a query
based
on Tbl_MainData.
The query for the Search screen only contains:
[RecordID], [Title], [DateLastUpdated], [Status], [Keywords] and [View] .
[View] has a default setting of "Click Here To View" and has a macro (from
On Click) that opens the form Frm_MainForm with the selected RecordID.

The Frm_MainForm then has a record source directly to Tbl_MainData. All
fields on this form are locked and can only be viewed by users. It
contains
the fields
[RecordID], [Title], [DateLastUpdated], [Status], [Keywords],
[Information],
[ContactPerson], [ContactPhoneNumber], [ApprovedBy] etc, and [LinkedInfo].

These are all bound fields (text boxes, dates etc. No Combos as the form
is
for viewing only) back to the table Tbl_MainData

This form has no functions or calculations except a Cmd button to close
and
another to bring up your search screen again so the user can search on
another topic. This all works perfectly (As stated before the recordset
does
filter as 1 of 1).

The only other 'performance' this form needs to do is with the
[LinkedInfo]
field.
Many records will have nothing in this field, others will have the title
to
another record when it is of a similar topic. What I want it to do is when
clicked, change the record currently being viewed to the one that was in
the
[LinkedInfo] field.

Adding/editing of records is done through another form
(Frm_MainScreenMaint)This has all the fields unlocked and the [LinkedInfo]
field is a Combo box ON THIS FORM linked to [Title], thereby making sure
that
data entered matches info appearing in the Title field.

You may need a rest after reading that but hopefully that makes a little
more sense.. Can I do what I want to do????



Allen Browne said:
Use an unbound text box for the user to enter the value to find.

If you want to search 2 fields to find the value, you would build the
filter
string like this:

If Not IsNull(Me.txtWot2Find) Then
strWhere = strWhere & "(([Title] = """ & Me.txtWot2Find & _
""") OR ([LinkedInfo] = """ & Me.txtWot2Find & """)) AND "
End If

That's assuming you need to use this as part of the utility you referred
to
in your original post, which I think is:
http://allenbrowne.com/ser-62.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Sorry Allen,
Thanks for your help, this is the last bug in my database!!

The database is being used as a procedure manual of sorts for
electricity
faults. Users do not edit or load info (Only a Supervisor can add/edit
info
and this is done through another form).
They search a topic, say Damaged Street lights.
This appears on the form in Field 1 [Title] along with relevant info.
One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
On many records [LinkedInfo] may be empty (no other pages with relevant
info
to the record being viewed) However, some pages may have the title to
another
record (in the example above "Installing New Street Lights".

Therefore when viewing the Damaged Street Lights record and the user
clicks
[LinkedInfo] the record changes now showing [Title] = Installing New
Street
Lights (as these two records are about the same topic). - Vice versa
"Installing New Street Lights" has "Damaged Street Lights" appearing in
its
[LinkedInfo] field.

I may have set this up wrong so any suggestions would be appreciated.

:

Not sure I understand what you are doing here.

Is Field2 *unbound*? If so, you are not entering a value to save,
merely
a
value to find.

Or is Field2 *bound* to a field? If so, entering something will save
to
that
field - proabaly not what you intend. Trying to use the one box to
filter
and enter data is likely to lead to confusion.

Or are you using Filter By Form or some other mode?

Or are you trying to use Filter By Selection?

Applying or removing a filter will have the effect of loading the form
again, and hence moving to the first record.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Thanks Allen,

I have tried that and it doesn't work as soon as the filter is
removed
the
form goes back to record 1 and it then doesn't know what was entered
in
Feild2 on the record that was being viewed (some records don't have
anything
in this field, others have the name of another record with a similar
topic)

Does this make sense??? Sometimes I tend to confuse myself!!

:

It makes sense that if the record you want is filtered out of the
form,
it
will not be found.

If you wish to remove the filter so the record can be found, add
this
line
above your code:
If Me.FilterOn Then Me.FilterOn = False

I have a DB that users access pages via Allen Browne's search
screen
(Thank
god for this! I was having troubles getting a keyword search to
work)
When users click on a result it comes up as filtered (record 1 of
1).
However on my form there is a text field that the user can click
on
to
take
them to another record thats of a similar topic to the record
they
are
currently using.

The below works when all records are 'viewable' but not when the
user
has
selected the record from the search screen.
DoCmd.GoToControl "Field1"
DoCmd.FindRecord Field2
 
A

Allen Browne

Okay, obviously we can't do this for you, but once you have the
relationships in place, you can work on the form.

You will need to build the filter string for what you are searching form,
turn off the filter, FindFirst in the RecordsetClone of the form, and then
match the bookmarks.

Something like this:

Dim rs As DAO.Recordset
Dim strWhere As String
If IsNull(Me.LinkedIn) Then
Beep
Else
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then Me.FilterOn = False
strWhere = "[RecordID] = "& Me.LinkedIn
Set rs = Me.RecorsetClone
rs.FindFirst strWhere
If rs.NoMatch Then
MsgBox "Not found"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
 
A

Alamath Carter

I am having a similar problem in a form. The command worked before I decided that I need to limit the visibility of the data depending on the members of the project team. I have a combo box in the form that the user selects the project that they wish to work on and the combo box is used to select the data set associated with that project. The problem is that this Duplicate Record button that I had in the form doesn't work anymore because the FindRecord gives me an error. Any ideas on how to get around this?

AC

Private Sub DupRecord_Click()
On Error GoTo Err_DupRecord_Click

Dim Rst As Recordset
Dim stProj, stRev, stDiscipline, stDesigner, stEngineer As Variant
Dim stArea, stDwgNum, stDwg1, stDwg2, stDwg3, stDwg4, stRemarks, stTypeID As Variant
Dim numDraftStatus, numEngrStatus, numDraftBudget, numEngrBudget As Long
Dim stDesignArea, stUnit, stMedia, stFileLocation As Variant
Dim stFinalDeliverable As Variant
Dim rstlocation As Integer


stProj = Me!tbxProjectNumber.Value
stArea = Me!Area.Value
stUnit = Me!Unit.Value
stRev = Me!Rev_Num.Value
stDiscipline = Me!Discipline.Value
stDwgNum = Me![Drawing Number].Value & " Copy"
stDwg1 = Me![Drawing Title First Line].Value
stDwg2 = Me![Drawing Title Second Line].Value
stDwg3 = Me![Drawing Title Third Line].Value
stDwg4 = Me![Drawing Title Fourth Line].Value
stRemarks = Me!Remarks.Value
stTypeID = Me!Type_ID.Value
numDraftStatus = Me!DraftStatus_ID.Value
numEngrStatus = Me!EngrStatus_ID.Value
numDraftBudget = Me!DraftingBudget.Value
numEngrBudget = Me!EngineeringBudget.Value
stDesigner = Me!Designer.Value
stEngineer = Me!Engineer.Value
stMedia = Me!Media
stFinalDeliverable = Me!FinalDeliverable
stFileLocation = Me!FileLocation


Set Rst = Me.RecordsetClone


Rst.AddNew
Rst![Project Number] = stProj
Rst![Drawing Number] = stDwgNum
Rst![Revision Number] = stRev
Rst![Area] = stArea
Rst![Unit] = stUnit
Rst![Discipline] = stDiscipline
Rst![Drawing Title First Line] = stDwg1
Rst![Drawing Title Second Line] = stDwg2
Rst![Drawing Title Third Line] = stDwg3
Rst![Drawing Title Fourth Line] = stDwg4
Rst![Remarks] = stRemarks
Rst![Type_ID] = stTypeID
Rst![DraftStatus_ID] = numDraftStatus
Rst![EngrStatus_ID] = numEngrStatus
Rst![DraftingBudget] = numDraftBudget
Rst![EngineeringBudget] = numEngrBudget
Rst![Designer] = stDesigner
Rst![Engineer] = stEngineer
Rst!Media = stMedia
Rst!FinalDeliverable = stFinalDeliverable
Rst!FileLocation = stFileLocation
Rst.Update
Rst.Close

'Me.Requery

DoCmd.ApplyFilter , "[Project Number] = '" & stProj & "'"

DoCmd.FindRecord stDwgNum, , , , , acAll, False

Exit_DupRecord_Click:
Exit Sub

Err_DupRecord_Click:
MsgBox Err.Description
Resume Exit_DupRecord_Click

End Sub
 
S

Stefan Hoffmann

hi,

Alamath said:
[..] because the FindRecord gives me an error. Any ideas on how to get around this?
Private Sub DupRecord_Click()
On Error GoTo Err_DupRecord_Click

Dim Rst As Recordset
You should declare it as DAO.Recordset to aviod the possible ambiguity
with ADODB.Recordset.
Dim stProj, stRev, stDiscipline, stDesigner, stEngineer As Variant
Dim stArea, stDwgNum, stDwg1, stDwg2, stDwg3, stDwg4, stRemarks, stTypeID As Variant
Dim numDraftStatus, numEngrStatus, numDraftBudget, numEngrBudget As Long
Dim stDesignArea, stUnit, stMedia, stFileLocation As Variant
In VBA when you omit the As Type part of a declaration, each variable is
declared implicit As Variant.
So only numEngrBudget is declared as Long, the others are Variants.
This is strange, as you use a prefixes for most of you variables which
indicate another type than Variant (st - string, num - number).
[..]
'Me.Requery
Does the requery not work?
DoCmd.ApplyFilter , "[Project Number] = '" & stProj & "'"
DoCmd.FindRecord stDwgNum, , , , , acAll, False
What error message do you get?


mfG
--> stefan <--
 

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

Similar Threads


Top