Reload query after data entry

G

guidop12

This is a two part question

I have a form that runs off a query. The query will ask the user to type in
a customer name, then the information willl come up for that account.

1. I would like the user to be able to only type in the first four
characters of the account name in order for the right account to come up in
the form.

2. I would like to have the user to type in the account name to bring up the
account then do the data entry work, then have the prompt to come up to enter
another account name.

I'm pretty new at this but I'm using this forum to research my questions

Thank you in advance for any help on this.
 
A

Allen Browne

I suggest you remove the criteria from the query, and instead use an unbound
combo box on your form to bring up the desired record(s.)

Will the customer name be unique? Or could the customer name match several
accounts?

If unique, use something like this to jump to the desired record:
Using a Combo Box to Find Records
at:
http://allenbrowne.com/ser-03.html

If not unqiue, use the AfterUpdate event of the unbound combo to filter the
form. The user can then use the navigation buttons to move through the
matching records to find the right one.
 
K

Klatuu

Take the parameter out of the query. Use a Combo Box control to input the
account number. It will show matches as you type and the user can select the
desired record in as few keystrokes as it takes to locate it. Then use the
After Update event of the Combo to naviage to the selected record.

Here is an example of how it can be done:

'---------------------------------------------------------------------------------------
' Procedure : cboClientID_AfterUpdate
' DateTime : 5/12/2006 08:52
' Author : Dave Hargis
' Purpose :
'---------------------------------------------------------------------------------------
'
Private Sub cboClientID_AfterUpdate()
On Error GoTo cboClientID_AfterUpdate_Error

With Me.RecordsetClone
.FindFirst "[ClientID] = " & Me.cboClientID.Column(0)
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With


cboClientID_AfterUpdate_Exit:

Exit Sub
On Error GoTo 0

cboClientID_AfterUpdate_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure cboClientID_AfterUpdate of VBA Document Form_Form2"
GoTo cboClientID_AfterUpdate_Exit
End Sub
 
G

guidop12

Thank you that work great.

A new question: The form below is associated with a table of 98 differnet
departments that the user will data entry in a piece count and postage amount
each day for each department. The way I have it set up is that each line on
the table has a department and then I created a subdatasheet for each one. I
would like the form to update the subdatasheet each time the user puts in a
new entry but right now it justs overwrites the first one. What do i need to
do to allow this.

Thanks

Klatuu said:
Take the parameter out of the query. Use a Combo Box control to input the
account number. It will show matches as you type and the user can select the
desired record in as few keystrokes as it takes to locate it. Then use the
After Update event of the Combo to naviage to the selected record.

Here is an example of how it can be done:

'---------------------------------------------------------------------------------------
' Procedure : cboClientID_AfterUpdate
' DateTime : 5/12/2006 08:52
' Author : Dave Hargis
' Purpose :
'---------------------------------------------------------------------------------------
'
Private Sub cboClientID_AfterUpdate()
On Error GoTo cboClientID_AfterUpdate_Error

With Me.RecordsetClone
.FindFirst "[ClientID] = " & Me.cboClientID.Column(0)
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With


cboClientID_AfterUpdate_Exit:

Exit Sub
On Error GoTo 0

cboClientID_AfterUpdate_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure cboClientID_AfterUpdate of VBA Document Form_Form2"
GoTo cboClientID_AfterUpdate_Exit
End Sub
--
Dave Hargis, Microsoft Access MVP


guidop12 said:
This is a two part question

I have a form that runs off a query. The query will ask the user to type in
a customer name, then the information willl come up for that account.

1. I would like the user to be able to only type in the first four
characters of the account name in order for the right account to come up in
the form.

2. I would like to have the user to type in the account name to bring up the
account then do the data entry work, then have the prompt to come up to enter
another account name.

I'm pretty new at this but I'm using this forum to research my questions

Thank you in advance for any help on this.
 
K

Klatuu

Sorry, I don't understand. Are you saying you are using a subform?
Can you describe the situation a little better, please.
--
Dave Hargis, Microsoft Access MVP


guidop12 said:
Thank you that work great.

A new question: The form below is associated with a table of 98 differnet
departments that the user will data entry in a piece count and postage amount
each day for each department. The way I have it set up is that each line on
the table has a department and then I created a subdatasheet for each one. I
would like the form to update the subdatasheet each time the user puts in a
new entry but right now it justs overwrites the first one. What do i need to
do to allow this.

Thanks

Klatuu said:
Take the parameter out of the query. Use a Combo Box control to input the
account number. It will show matches as you type and the user can select the
desired record in as few keystrokes as it takes to locate it. Then use the
After Update event of the Combo to naviage to the selected record.

Here is an example of how it can be done:

'---------------------------------------------------------------------------------------
' Procedure : cboClientID_AfterUpdate
' DateTime : 5/12/2006 08:52
' Author : Dave Hargis
' Purpose :
'---------------------------------------------------------------------------------------
'
Private Sub cboClientID_AfterUpdate()
On Error GoTo cboClientID_AfterUpdate_Error

With Me.RecordsetClone
.FindFirst "[ClientID] = " & Me.cboClientID.Column(0)
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With


cboClientID_AfterUpdate_Exit:

Exit Sub
On Error GoTo 0

cboClientID_AfterUpdate_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure cboClientID_AfterUpdate of VBA Document Form_Form2"
GoTo cboClientID_AfterUpdate_Exit
End Sub
--
Dave Hargis, Microsoft Access MVP


guidop12 said:
This is a two part question

I have a form that runs off a query. The query will ask the user to type in
a customer name, then the information willl come up for that account.

1. I would like the user to be able to only type in the first four
characters of the account name in order for the right account to come up in
the form.

2. I would like to have the user to type in the account name to bring up the
account then do the data entry work, then have the prompt to come up to enter
another account name.

I'm pretty new at this but I'm using this forum to research my questions

Thank you in advance for any help on this.
 
G

guidop12

Thats okay I figured out a different way of doing this. thanks

Klatuu said:
Sorry, I don't understand. Are you saying you are using a subform?
Can you describe the situation a little better, please.
--
Dave Hargis, Microsoft Access MVP


guidop12 said:
Thank you that work great.

A new question: The form below is associated with a table of 98 differnet
departments that the user will data entry in a piece count and postage amount
each day for each department. The way I have it set up is that each line on
the table has a department and then I created a subdatasheet for each one. I
would like the form to update the subdatasheet each time the user puts in a
new entry but right now it justs overwrites the first one. What do i need to
do to allow this.

Thanks

Klatuu said:
Take the parameter out of the query. Use a Combo Box control to input the
account number. It will show matches as you type and the user can select the
desired record in as few keystrokes as it takes to locate it. Then use the
After Update event of the Combo to naviage to the selected record.

Here is an example of how it can be done:

'---------------------------------------------------------------------------------------
' Procedure : cboClientID_AfterUpdate
' DateTime : 5/12/2006 08:52
' Author : Dave Hargis
' Purpose :
'---------------------------------------------------------------------------------------
'
Private Sub cboClientID_AfterUpdate()
On Error GoTo cboClientID_AfterUpdate_Error

With Me.RecordsetClone
.FindFirst "[ClientID] = " & Me.cboClientID.Column(0)
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With


cboClientID_AfterUpdate_Exit:

Exit Sub
On Error GoTo 0

cboClientID_AfterUpdate_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure cboClientID_AfterUpdate of VBA Document Form_Form2"
GoTo cboClientID_AfterUpdate_Exit
End Sub
--
Dave Hargis, Microsoft Access MVP


:

This is a two part question

I have a form that runs off a query. The query will ask the user to type in
a customer name, then the information willl come up for that account.

1. I would like the user to be able to only type in the first four
characters of the account name in order for the right account to come up in
the form.

2. I would like to have the user to type in the account name to bring up the
account then do the data entry work, then have the prompt to come up to enter
another account name.

I'm pretty new at this but I'm using this forum to research my questions

Thank you in advance for any help on this.
 

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