VB problem...

D

Debbie

Coding having problem with...

Private Sub txtSearch_AfterUpdate()
'Find the record that matches the control.
Me.RecordsetClone.FindFirst "[ProvID] = '" & Me!
[txtSearch] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Problem...
Coding above is supposed to pull up a search in an unbound
text field. It works find for a couple of times, but if
you try the search again, it comes up with an Action
Failed Window... saying

Macro Name:
cmdSAVE:Updated
Condition:
True
Action Name:
Set Value
Arguments:
[Forms]![frmMainScreen]![Date], Now()
 
K

Ken Snell

I'm guessing that the times it is not working, there is no match found. Try
changing your code to this:

Private Sub txtSearch_AfterUpdate()
'Find the record that matches the control.
Me.RecordsetClone.FindFirst "[ProvID] = '" & Me!
[txtSearch] & "'"
If Me.RecordsetClone.NoMatch = False Then _
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
 
B

Bruce M. Thompson

Problem...
Coding above is supposed to pull up a search in an unbound
text field. It works find for a couple of times, but if
you try the search again, it comes up with an Action
Failed Window... saying

Macro Name:
cmdSAVE:Updated
Condition:
True
Action Name:
Set Value
Arguments:
[Forms]![frmMainScreen]![Date], Now()

From which event is the above-named macro called? It appears to be trying to set
the value of a date field while you are trying to move to another record.
 
D

Debbie

Since this auto completes, the person data entering would
know right away if the numbers pulling are or are not
correct. Also, since this is still in testing phase, I
know that the numbers I'm pulling are correct. It's kind
of hard to miss an ID of 1234567. HA HA.

All I have to type is 123 and it prefills 4567 for me.

I will try your method and let you know if it works.

Thanks.

debbie =}

-----Original Message-----
I'm guessing that the times it is not working, there is no match found. Try
changing your code to this:

Private Sub txtSearch_AfterUpdate()
'Find the record that matches the control.
Me.RecordsetClone.FindFirst "[ProvID] = '" & Me!
[txtSearch] & "'"
If Me.RecordsetClone.NoMatch = False Then _
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
--
Ken Snell
<MS ACCESS MVP>

Debbie said:
Coding having problem with...

Private Sub txtSearch_AfterUpdate()
'Find the record that matches the control.
Me.RecordsetClone.FindFirst "[ProvID] = '" & Me!
[txtSearch] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Problem...
Coding above is supposed to pull up a search in an unbound
text field. It works find for a couple of times, but if
you try the search again, it comes up with an Action
Failed Window... saying

Macro Name:
cmdSAVE:Updated
Condition:
True
Action Name:
Set Value
Arguments:
[Forms]![frmMainScreen]![Date], Now()


.
 
K

Ken Snell

Also, I think Bruce's post is on the mark. It does appear that you have a
macro that is running during this process, and that it's trying to set a
value in a control named Date (which, by the way, is not a good name to use
for a control or variable.... Date is the name of a VBA function, and you
can confuse ACCESS!).

Perhaps there's more to the code that is running that what you've posted so
far?

Debbie said:
Since this auto completes, the person data entering would
know right away if the numbers pulling are or are not
correct. Also, since this is still in testing phase, I
know that the numbers I'm pulling are correct. It's kind
of hard to miss an ID of 1234567. HA HA.

All I have to type is 123 and it prefills 4567 for me.

I will try your method and let you know if it works.

Thanks.

debbie =}

-----Original Message-----
I'm guessing that the times it is not working, there is no match found. Try
changing your code to this:

Private Sub txtSearch_AfterUpdate()
'Find the record that matches the control.
Me.RecordsetClone.FindFirst "[ProvID] = '" & Me!
[txtSearch] & "'"
If Me.RecordsetClone.NoMatch = False Then _
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
--
Ken Snell
<MS ACCESS MVP>

Debbie said:
Coding having problem with...

Private Sub txtSearch_AfterUpdate()
'Find the record that matches the control.
Me.RecordsetClone.FindFirst "[ProvID] = '" & Me!
[txtSearch] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Problem...
Coding above is supposed to pull up a search in an unbound
text field. It works find for a couple of times, but if
you try the search again, it comes up with an Action
Failed Window... saying

Macro Name:
cmdSAVE:Updated
Condition:
True
Action Name:
Set Value
Arguments:
[Forms]![frmMainScreen]![Date], Now()


.
 
K

Ken Snell

Bruce -

Good eyes.... I missed the SetValue note in the original post!

--
Ken Snell
<MS ACCESS MVP>

Bruce M. Thompson said:
Problem...
Coding above is supposed to pull up a search in an unbound
text field. It works find for a couple of times, but if
you try the search again, it comes up with an Action
Failed Window... saying

Macro Name:
cmdSAVE:Updated
Condition:
True
Action Name:
Set Value
Arguments:
[Forms]![frmMainScreen]![Date], Now()

From which event is the above-named macro called? It appears to be trying to set
the value of a date field while you are trying to move to another record.
 
B

Bruce M. Thompson

Good eyes.... I missed the SetValue note in the original post!

That's okay, Ken. "Real" programmers never see that error message, do they?

<laugh>
 

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