Pop up msgbox

G

Guest

I have on my switchboard and update button that runs the following code.
What I would like is when I click the button it shows a "warning update
please wait" box then once the code runs it closes the pop up. I crated a
form and called it frmUpdateDBMsg here is the code I have and the error it is
going me.

Private Sub Command25_Click()
DoCmd.SetWarnings False
DoCmd.OpenForm acForm, "frmUpdateDBMsg"
CurrentDb.QueryDefs("qurinmtinfoAppend").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
CurrentDb.QueryDefs("qurOldInmates").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
CurrentDb.QueryDefs("qurDeleteOldInmates").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoCmd.Close acForm, "frmUpdateDBMsg"
DoEvents
DoCmd.SetWarnings True
CurrentDb.TableDefs.Refresh
DoEvents
End Sub

*** Run-time error'13':
Type mismatch....
When I click Debug it highlights this line of code....
DoCmd.OpenForm acForm, "frmUpdateDBMsg"
 
G

Guest

Check the syntax in VBA Help for the OpenForm method. It should be:

DoCmd.OpenForm "frmUpdateDBMsg"
 
G

Guest

oops...made a code error...I fixed the run-time error by removeing the
..OpenForm so now the line reads DoCmd.OpenacForm, "frmUpdateDBMsg"
now I get this....
the expression On Click you entered as the event property setting produced
the follwoing error:
Method or data member not found.
*The expression my not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.
 
G

Guest

Again, reading VBA Help will usually resolve this kind of problem.

Michelle said:
oops...made a code error...I fixed the run-time error by removeing the
.OpenForm so now the line reads DoCmd.OpenacForm, "frmUpdateDBMsg"
now I get this....
the expression On Click you entered as the event property setting produced
the follwoing error:
Method or data member not found.
*The expression my not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.

Michelle said:
I have on my switchboard and update button that runs the following code.
What I would like is when I click the button it shows a "warning update
please wait" box then once the code runs it closes the pop up. I crated a
form and called it frmUpdateDBMsg here is the code I have and the error it is
going me.

Private Sub Command25_Click()
DoCmd.SetWarnings False
DoCmd.OpenForm acForm, "frmUpdateDBMsg"
CurrentDb.QueryDefs("qurinmtinfoAppend").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
CurrentDb.QueryDefs("qurOldInmates").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
CurrentDb.QueryDefs("qurDeleteOldInmates").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoCmd.Close acForm, "frmUpdateDBMsg"
DoEvents
DoCmd.SetWarnings True
CurrentDb.TableDefs.Refresh
DoEvents
End Sub

*** Run-time error'13':
Type mismatch....
When I click Debug it highlights this line of code....
DoCmd.OpenForm acForm, "frmUpdateDBMsg"
 
F

fredg

oops...made a code error...I fixed the run-time error by removeing the
.OpenForm so now the line reads DoCmd.OpenacForm, "frmUpdateDBMsg"
now I get this....
the expression On Click you entered as the event property setting produced
the follwoing error:
Method or data member not found.
*The expression my not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.

Michelle said:
I have on my switchboard and update button that runs the following code.
What I would like is when I click the button it shows a "warning update
please wait" box then once the code runs it closes the pop up. I crated a
form and called it frmUpdateDBMsg here is the code I have and the error it is
going me.

Private Sub Command25_Click()
DoCmd.SetWarnings False
DoCmd.OpenForm acForm, "frmUpdateDBMsg"
CurrentDb.QueryDefs("qurinmtinfoAppend").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
CurrentDb.QueryDefs("qurOldInmates").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
CurrentDb.QueryDefs("qurDeleteOldInmates").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoCmd.Close acForm, "frmUpdateDBMsg"
DoEvents
DoCmd.SetWarnings True
CurrentDb.TableDefs.Refresh
DoEvents
End Sub

*** Run-time error'13':
Type mismatch....
When I click Debug it highlights this line of code....
DoCmd.OpenForm acForm, "frmUpdateDBMsg"

Check VBA help.
The proper syntax for the OpenForm method is....

DoCmd.OpnForm "frmUpdateDBMsg"

Nowhere in the syntax is there an acForm reference.

If you had meant to open the form in datasheet view, then you would use:
DoCmd.OpnForm "frmUpdateDBMsg", acFormDS
 
G

Guest

OK this is what I have now....


Private Sub Command25_Click()
DoCmd.SetWarnings False
DoCmd.OpenForm "frmUpdateDBMsg"
CurrentDb.QueryDefs("qurinmtinfoAppend").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
CurrentDb.QueryDefs("qurOldInmates").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
CurrentDb.QueryDefs("qurDeleteOldInmates").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
DoCmd.SetWarnings True
CurrentDb.TableDefs.Refresh
DoEvents
DoCmd.Close acForm, "frmUdateDBMsg"
End Sub



It opens the from but does not close it once all the other code runs...plus
when this is running for some reason in task manager it shows not
responding...is there something else wrong with my code?
fredg said:
oops...made a code error...I fixed the run-time error by removeing the
.OpenForm so now the line reads DoCmd.OpenacForm, "frmUpdateDBMsg"
now I get this....
the expression On Click you entered as the event property setting produced
the follwoing error:
Method or data member not found.
*The expression my not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.

Michelle said:
I have on my switchboard and update button that runs the following code.
What I would like is when I click the button it shows a "warning update
please wait" box then once the code runs it closes the pop up. I crated a
form and called it frmUpdateDBMsg here is the code I have and the error it is
going me.

Private Sub Command25_Click()
DoCmd.SetWarnings False
DoCmd.OpenForm acForm, "frmUpdateDBMsg"
CurrentDb.QueryDefs("qurinmtinfoAppend").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
CurrentDb.QueryDefs("qurOldInmates").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoEvents
CurrentDb.QueryDefs("qurDeleteOldInmates").Execute dbFailOnError
CurrentDb.TableDefs.Refresh
DoCmd.Close acForm, "frmUpdateDBMsg"
DoEvents
DoCmd.SetWarnings True
CurrentDb.TableDefs.Refresh
DoEvents
End Sub

*** Run-time error'13':
Type mismatch....
When I click Debug it highlights this line of code....
DoCmd.OpenForm acForm, "frmUpdateDBMsg"

Check VBA help.
The proper syntax for the OpenForm method is....

DoCmd.OpnForm "frmUpdateDBMsg"

Nowhere in the syntax is there an acForm reference.

If you had meant to open the form in datasheet view, then you would use:
DoCmd.OpnForm "frmUpdateDBMsg", acFormDS
 

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