forms tied to queries

  • Thread starter Thread starter cporter
  • Start date Start date
C

cporter

I have a form tied to the query below. If the query doesn't find the
workorder number entered the form still opens and people try to use it.
I need to make it so an error message pops up if the workorder isn't
valid. What are my options?







SELECT tblPMWO.wono, tblPMWO.MACHID, tblPMWO.Action, tblPMWO.Request1,
tblPMWO.DayDown, tblPMWO.TimeDown, tblPMWO.Dayup, tblPMWO.TimeUp,
tblPMWO.THD, tblPMWO.SUBSYS, tblPMWO.EMPLOYEE, tblPMWO.COMMENT1,
tblPMWO.COMMENT2
FROM tblPMWO
WHERE (((tblPMWO.wono)=[workorder number]));
 
Use the form's Open event:

If Me.Recordset.RecordCount < 1 Then
MsgBox "No Record Found"
Cancel = True
End If
 
Using your syntax in the form's open event slot I get an error message:


Microsoft Access can't find the macro 'If Me'


Is there an add in or something I need to activate?





Use the form's Open event:

If Me.Recordset.RecordCount < 1 Then
MsgBox "No Record Found"
Cancel = True
End If


I have a form tied to the query below. If the query doesn't find the
workorder number entered the form still opens and people try to use it.
I need to make it so an error message pops up if the workorder isn't
valid. What are my options?







SELECT tblPMWO.wono, tblPMWO.MACHID, tblPMWO.Action, tblPMWO.Request1,
tblPMWO.DayDown, tblPMWO.TimeDown, tblPMWO.Dayup, tblPMWO.TimeUp,
tblPMWO.THD, tblPMWO.SUBSYS, tblPMWO.EMPLOYEE, tblPMWO.COMMENT1,
tblPMWO.COMMENT2
FROM tblPMWO
WHERE (((tblPMWO.wono)=[workorder number]));
 
What version of Access are you using?

Using your syntax in the form's open event slot I get an error message:


Microsoft Access can't find the macro 'If Me'


Is there an add in or something I need to activate?





Use the form's Open event:

If Me.Recordset.RecordCount < 1 Then
MsgBox "No Record Found"
Cancel = True
End If


I have a form tied to the query below. If the query doesn't find the
workorder number entered the form still opens and people try to use it.
I need to make it so an error message pops up if the workorder isn't
valid. What are my options?







SELECT tblPMWO.wono, tblPMWO.MACHID, tblPMWO.Action, tblPMWO.Request1,
tblPMWO.DayDown, tblPMWO.TimeDown, tblPMWO.Dayup, tblPMWO.TimeUp,
tblPMWO.THD, tblPMWO.SUBSYS, tblPMWO.EMPLOYEE, tblPMWO.COMMENT1,
tblPMWO.COMMENT2
FROM tblPMWO
WHERE (((tblPMWO.wono)=[workorder number]));
 
Klatuu assumed you understood to open the Module window for the On Open
event. When ever someone in these news groups offers "code", you should open
the event procedure window and enter the code.


--
Duane Hookom
MS Access MVP


Using your syntax in the form's open event slot I get an error message:


Microsoft Access can't find the macro 'If Me'


Is there an add in or something I need to activate?





Use the form's Open event:

If Me.Recordset.RecordCount < 1 Then
MsgBox "No Record Found"
Cancel = True
End If


I have a form tied to the query below. If the query doesn't find the
workorder number entered the form still opens and people try to use it.
I need to make it so an error message pops up if the workorder isn't
valid. What are my options?







SELECT tblPMWO.wono, tblPMWO.MACHID, tblPMWO.Action, tblPMWO.Request1,
tblPMWO.DayDown, tblPMWO.TimeDown, tblPMWO.Dayup, tblPMWO.TimeUp,
tblPMWO.THD, tblPMWO.SUBSYS, tblPMWO.EMPLOYEE, tblPMWO.COMMENT1,
tblPMWO.COMMENT2
FROM tblPMWO
WHERE (((tblPMWO.wono)=[workorder number]));
 
I haven't found a VBA tutorial on the Access website yet so assuming
that would probably be a bad thing. I'm sure I could screw something up
really well that way.

In any event, I have been able to get the form to work as desired with
both of your help. Thank you.



Duane said:
Klatuu assumed you understood to open the Module window for the On Open
event. When ever someone in these news groups offers "code", you should open
the event procedure window and enter the code.


--
Duane Hookom
MS Access MVP


Using your syntax in the form's open event slot I get an error message:


Microsoft Access can't find the macro 'If Me'


Is there an add in or something I need to activate?





Use the form's Open event:

If Me.Recordset.RecordCount < 1 Then
MsgBox "No Record Found"
Cancel = True
End If


:

I have a form tied to the query below. If the query doesn't find the
workorder number entered the form still opens and people try to use it.
I need to make it so an error message pops up if the workorder isn't
valid. What are my options?







SELECT tblPMWO.wono, tblPMWO.MACHID, tblPMWO.Action, tblPMWO.Request1,
tblPMWO.DayDown, tblPMWO.TimeDown, tblPMWO.Dayup, tblPMWO.TimeUp,
tblPMWO.THD, tblPMWO.SUBSYS, tblPMWO.EMPLOYEE, tblPMWO.COMMENT1,
tblPMWO.COMMENT2
FROM tblPMWO
WHERE (((tblPMWO.wono)=[workorder number]));
 

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

Back
Top