Textbox Filter

P

Pam

Hi,

I have the code listed below to open form to job number that is typed in
text box - works great, but how do I tweek the code to make it also open to
a new blank record when user need to start a new job. The job number is an
autonumber so they won't know the next job number available.

Private Sub txtJobNumber_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[JobNumber]=" & Str(Nz(Me![TxtJobNumber], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Thanks in advance for any help.
Pam
 
A

Amy E. Baggott

I would put a button on the form where the user is entering the job number
labeled "start new job". The On Click event of the button would include

DoCmd.OpenForm "<form name>", acNormal, , , acFormAdd, acWindowNormal

Where <form name> is the name of the form you are opening. They Button
Wizard can also do this for you automatically.
 
P

Pam

Amy,

Thanks for replying, but I would rather have all actions and code with one
text box if I can. If not, then I may have to do something like you
suggested.

Thanks,
Pam

Amy E. Baggott said:
I would put a button on the form where the user is entering the job number
labeled "start new job". The On Click event of the button would include

DoCmd.OpenForm "<form name>", acNormal, , , acFormAdd, acWindowNormal

Where <form name> is the name of the form you are opening. They Button
Wizard can also do this for you automatically.

--
Amy E. Baggott

"I''m going crazy and I''m taking all of you with me!" -- Linda Grayson


Pam said:
Hi,

I have the code listed below to open form to job number that is typed in
text box - works great, but how do I tweek the code to make it also open
to
a new blank record when user need to start a new job. The job number is
an
autonumber so they won't know the next job number available.

Private Sub txtJobNumber_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[JobNumber]=" & Str(Nz(Me![TxtJobNumber], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Thanks in advance for any help.
Pam


.
 
A

Amy E. Baggott

You could probably put the code in the On Double Click event of the text box
and have a label on the form that tells them to double-click the box to add a
new job. The button is a little more intuitive from the user standpoint.

--
Amy E. Baggott

"I''m going crazy and I''m taking all of you with me!" -- Linda Grayson


Pam said:
Amy,

Thanks for replying, but I would rather have all actions and code with one
text box if I can. If not, then I may have to do something like you
suggested.

Thanks,
Pam

Amy E. Baggott said:
I would put a button on the form where the user is entering the job number
labeled "start new job". The On Click event of the button would include

DoCmd.OpenForm "<form name>", acNormal, , , acFormAdd, acWindowNormal

Where <form name> is the name of the form you are opening. They Button
Wizard can also do this for you automatically.

--
Amy E. Baggott

"I''m going crazy and I''m taking all of you with me!" -- Linda Grayson


Pam said:
Hi,

I have the code listed below to open form to job number that is typed in
text box - works great, but how do I tweek the code to make it also open
to
a new blank record when user need to start a new job. The job number is
an
autonumber so they won't know the next job number available.

Private Sub txtJobNumber_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[JobNumber]=" & Str(Nz(Me![TxtJobNumber], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Thanks in advance for any help.
Pam


.


.
 
P

Pam

Nevermind, I figured it out.
Thanks.

Pam said:
Amy,

Thanks for replying, but I would rather have all actions and code with one
text box if I can. If not, then I may have to do something like you
suggested.

Thanks,
Pam

Amy E. Baggott said:
I would put a button on the form where the user is entering the job number
labeled "start new job". The On Click event of the button would include

DoCmd.OpenForm "<form name>", acNormal, , , acFormAdd, acWindowNormal

Where <form name> is the name of the form you are opening. They Button
Wizard can also do this for you automatically.

--
Amy E. Baggott

"I''m going crazy and I''m taking all of you with me!" -- Linda Grayson


Pam said:
Hi,

I have the code listed below to open form to job number that is typed in
text box - works great, but how do I tweek the code to make it also open
to
a new blank record when user need to start a new job. The job number is
an
autonumber so they won't know the next job number available.

Private Sub txtJobNumber_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[JobNumber]=" & Str(Nz(Me![TxtJobNumber], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Thanks in advance for any help.
Pam


.
 

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