Can't open new record in calculate form

Avick

Registered User.
Local time
Today, 18:07
Joined
Mar 11, 2000
Messages
49
I hope someone can help. I have a form that is based on a table and a second form that is based on a query. On the first form the person will enter information such as paper lenght and box's produced. When they click a button "Calculate" It takes them to a second form that will display the calculations for the first form. It works OK but when i enter a new record and click "Calculate" the second form is blank. Is there any way i can save the record and open the calculate form in one button click and view my results.

Thank you in advance.
 
You should have the second form close each time it is used. Otherwise, it will not requery without being told to do so. My suggestion is that the buttonclick (commandbutton) be set with code to:

DoCmd.Save "frmForm1"
DoCmd.OpenForm "Form2", acNormal, , , acEdit
 
I have tried this to no avail. I get a message "Type mismatch"
Here is the code.
Private Sub calculate_Click()
On Error GoTo Err_calculate_Click

Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.Save
stDocName = "calculate"
DoCmd.Save "Batch Costing"
stLinkCriteria = "[ba_id]=" & "'" & Me![ba_id] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_calculate_Click:
Exit Sub

Err_calculate_Click:
MsgBox Err.Description
Resume Exit_calculate_Click

End Sub

The First form is called " Batch Costing " and the secound is "calculate"

The idea is that when i enter a new record in "Batch Costing" it will calculate in "calculate" The first form is coming from a table and the second is coming from a query that runs the calculation.
 
DoCmd.RunCommand.acCommand, SaveRecord
Use a macro to build the statement and then convert it to vb for the correct syntax.
HTH
 
Thanks for that. It now works the way I want.
 

Users who are viewing this thread

Back
Top Bottom