run query from form

G

Guest

Hi
I have a form with felds from query named select code so when form/query
opens a msgbox appears requesting code to be entered in form I have also
wriiten a on load event to sort data etc and a afterupdate on field issue to
enter date in dateentered field these all work but I need the user to be able
to run query again while in form so new code can be entered when press ! run
button this does not happen do I need new event if so what one ?
Thanks
 
J

Jeff Boyce

Tina

I'm having a bit of trouble following your description/question, partially
due to a lack of punctuation.

Perhaps you could post the SQL of your query?
 
G

Guest

Sorry for confusion.
I will try to explain better, but I am at bit confused myself.
my query named select code has following sql code. This requests user to
enter code plus shows records where issue number is greater than zero ,to
show records where data has previously been entered.
SELECT manu.CODE, manu.DESCRIPTION, manu.Company, manu.manufacurer,
manu.[assesment number], manu.issue, manu.dateentered
FROM manu
WHERE (((manu.CODE)=[ENTER CODE])) OR (((manu.issue)>"0"));

my form created from above query has following events.

Private Sub Form_Load()
Me.assesment_number.SetFocus
DoCmd.RunMacro "MACROSORT"
DoCmd.GoToRecord , , acFirst
Me.issue.SetFocus
End Sub

Private Sub issue_AfterUpdate()
Dim MYSTRING As String
MYSTRING = Me.MYTSAF
If Me.issue = 1 Then
Me.assesment_number = MYSTRING & Me.MYCOUNT + 1
Else
End If
Me.dateentered = Now
Me.manufacurer.SetFocus
End Sub

My problem is when form is open I would like to be able to run the query
again . but when press the ! (run ) button the query is not run.
Hope this makes better sense
Thanks
Tina
 
J

Jeff Boyce

Tina

I just (re-)looked at an Access 2000 form, but did not see a "!" button on
the menu or toolbar.

How is it that your form has a <run query> button on it?

Jeff Boyce
<Access MVP>

tina said:
Sorry for confusion.
I will try to explain better, but I am at bit confused myself.
my query named select code has following sql code. This requests user to
enter code plus shows records where issue number is greater than zero ,to
show records where data has previously been entered.
SELECT manu.CODE, manu.DESCRIPTION, manu.Company, manu.manufacurer,
manu.[assesment number], manu.issue, manu.dateentered
FROM manu
WHERE (((manu.CODE)=[ENTER CODE])) OR (((manu.issue)>"0"));

my form created from above query has following events.

Private Sub Form_Load()
Me.assesment_number.SetFocus
DoCmd.RunMacro "MACROSORT"
DoCmd.GoToRecord , , acFirst
Me.issue.SetFocus
End Sub

Private Sub issue_AfterUpdate()
Dim MYSTRING As String
MYSTRING = Me.MYTSAF
If Me.issue = 1 Then
Me.assesment_number = MYSTRING & Me.MYCOUNT + 1
Else
End If
Me.dateentered = Now
Me.manufacurer.SetFocus
End Sub

My problem is when form is open I would like to be able to run the query
again . but when press the ! (run ) button the query is not run.
Hope this makes better sense
Thanks
Tina
Jeff Boyce said:
Tina

I'm having a bit of trouble following your description/question, partially
due to a lack of punctuation.

Perhaps you could post the SQL of your query?

--
More info, please ...

Jeff Boyce
<Access MVP>

issue
to be
able !
run
 
G

Guest

Hi
I used view toolbars customise records to get run button. As not on form
toolbar should of realised it would not work. I created a command button to
close form and re-open this seems to work
Thanks for your time

Jeff Boyce said:
Tina

I just (re-)looked at an Access 2000 form, but did not see a "!" button on
the menu or toolbar.

How is it that your form has a <run query> button on it?

Jeff Boyce
<Access MVP>

tina said:
Sorry for confusion.
I will try to explain better, but I am at bit confused myself.
my query named select code has following sql code. This requests user to
enter code plus shows records where issue number is greater than zero ,to
show records where data has previously been entered.
SELECT manu.CODE, manu.DESCRIPTION, manu.Company, manu.manufacurer,
manu.[assesment number], manu.issue, manu.dateentered
FROM manu
WHERE (((manu.CODE)=[ENTER CODE])) OR (((manu.issue)>"0"));

my form created from above query has following events.

Private Sub Form_Load()
Me.assesment_number.SetFocus
DoCmd.RunMacro "MACROSORT"
DoCmd.GoToRecord , , acFirst
Me.issue.SetFocus
End Sub

Private Sub issue_AfterUpdate()
Dim MYSTRING As String
MYSTRING = Me.MYTSAF
If Me.issue = 1 Then
Me.assesment_number = MYSTRING & Me.MYCOUNT + 1
Else
End If
Me.dateentered = Now
Me.manufacurer.SetFocus
End Sub

My problem is when form is open I would like to be able to run the query
again . but when press the ! (run ) button the query is not run.
Hope this makes better sense
Thanks
Tina
Jeff Boyce said:
Tina

I'm having a bit of trouble following your description/question, partially
due to a lack of punctuation.

Perhaps you could post the SQL of your query?

--
More info, please ...

Jeff Boyce
<Access MVP>

Hi
I have a form with felds from query named select code so when form/query
opens a msgbox appears requesting code to be entered in form I have also
wriiten a on load event to sort data etc and a afterupdate on field issue
to
enter date in dateentered field these all work but I need the user to be
able
to run query again while in form so new code can be entered when press !
run
button this does not happen do I need new event if so what one ?
Thanks
 

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