Programming Buttons

G

Guest

I ahve two forms: Work Order Form and a Navigation Form. The Navigation
form has the buttons, such as "Print Current Job", "Delete Current Job", Etc.

The problem is that the functions apply to the Navigation Form and not the
Work Orcer Form.

How do I change the code for the buttons to apply to the other form?

Here is an example of the code:

Private Sub Delete_Current_Job_Click()
On Error GoTo Err_Delete_Current_Job_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_Delete_Current_Job_Click:
Exit Sub

Err_Delete_Current_Job_Click:
MsgBox Err.Description
Resume Exit_Delete_Current_Job_Click

End Sub
 
G

Guest

Assuming that the second form is Open and seperate from the first form.
Run a delete SQL to delete the record from the table that the second form is
linked to, , and then refresh the second form

Docmd.RunSql "DELETE TableName.* FROM TableName WHERE IdField =" & Me.IDField
Forms![SecondFormName].Requery

To the delete SQL you need to apply a filter that will delete the right
record.
Before trying anything, please back up your data.
 
G

Guest

I tried that using the table name and the query name, but I get the same
error either way:

Compile Error
Method or data member not found

and then it goes to VBA and highlights the ".IDField"


Ofer Cohen said:
Assuming that the second form is Open and seperate from the first form.
Run a delete SQL to delete the record from the table that the second form is
linked to, , and then refresh the second form

Docmd.RunSql "DELETE TableName.* FROM TableName WHERE IdField =" & Me.IDField
Forms![SecondFormName].Requery

To the delete SQL you need to apply a filter that will delete the right
record.
Before trying anything, please back up your data.

--
Good Luck
BS"D


Christian > said:
I ahve two forms: Work Order Form and a Navigation Form. The Navigation
form has the buttons, such as "Print Current Job", "Delete Current Job", Etc.

The problem is that the functions apply to the Navigation Form and not the
Work Orcer Form.

How do I change the code for the buttons to apply to the other form?

Here is an example of the code:

Private Sub Delete_Current_Job_Click()
On Error GoTo Err_Delete_Current_Job_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_Delete_Current_Job_Click:
Exit Sub

Err_Delete_Current_Job_Click:
MsgBox Err.Description
Resume Exit_Delete_Current_Job_Click

End Sub
 
G

Guest

The ID field was an example to how delete a certain record.
When you delete the record from the table, which field is used to specify
which field is to be deleted?

--
Good Luck
BS"D


Christian > said:
I tried that using the table name and the query name, but I get the same
error either way:

Compile Error
Method or data member not found

and then it goes to VBA and highlights the ".IDField"


Ofer Cohen said:
Assuming that the second form is Open and seperate from the first form.
Run a delete SQL to delete the record from the table that the second form is
linked to, , and then refresh the second form

Docmd.RunSql "DELETE TableName.* FROM TableName WHERE IdField =" & Me.IDField
Forms![SecondFormName].Requery

To the delete SQL you need to apply a filter that will delete the right
record.
Before trying anything, please back up your data.

--
Good Luck
BS"D


Christian > said:
I ahve two forms: Work Order Form and a Navigation Form. The Navigation
form has the buttons, such as "Print Current Job", "Delete Current Job", Etc.

The problem is that the functions apply to the Navigation Form and not the
Work Orcer Form.

How do I change the code for the buttons to apply to the other form?

Here is an example of the code:

Private Sub Delete_Current_Job_Click()
On Error GoTo Err_Delete_Current_Job_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_Delete_Current_Job_Click:
Exit Sub

Err_Delete_Current_Job_Click:
MsgBox Err.Description
Resume Exit_Delete_Current_Job_Click

End Sub
 

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