Updating problem ....cant seem to get it to refresh

B

Ben

brief synopsis
Database designed to track export animal consignments. Thus we have
export animals grouped by consignment ID - referential integrity to a
Consignment table (2 columns - date and ID(primary key)

Now here lies the problem I have a button on my consignment form with
the following code
Private Sub Open_animal_details_Click()
On Error GoTo Err_Open_animal_details_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim animalctl As String
Dim ConID As Integer

ConID = Forms!Consignment![Consignment ID]
stDocName = "Animal Details"
animalctl = "Consignment ID"
stLinkCriteria = "[Consignment ID]=" & Me![Consignment ID]

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToControl animalctl
Forms![Animal Details]![Consignment ID] = ConID
DoCmd.GoToControl "Animal Name"
Forms![Animal Details]![Consignment ID].Enabled = False
DoCmd.Close acForm, "Consignment", acSaveYes




Exit_Open_animal_details_Click:
Exit Sub

Err_Open_animal_details_Click:
MsgBox Err.Description
Resume Exit_Open_animal_details_Click

End Sub

That works fine opens the details form and sets the Consignment id
correctly and all
the problem is when I return to the Consignment form using the
following code

Private Sub closebacktoconsignment_Click()
On Error GoTo Err_closebacktoconsignment_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Consignment"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Animal Details", acSaveYes
Exit_closebacktoconsignment_Click:
Exit Sub

Err_closebacktoconsignment_Click:
MsgBox Err.Description
Resume Exit_closebacktoconsignment_Click

End Sub

It nicely goes back...but when I try to generate a report with my next
click based on the consignment ID - it doesnt seem to have saved the
data...even refreshing doesn't seem to help.

Anyideas what I might be doing wrong

Cheers guys

Ben

Ps just so we are clear - first shot at a database and I possibly may
be in over my head
 
T

TC

I suggest that your best bet would be to describe your tables first.
Then, if those seem good, people will have a better chance of helping
with your original question.

Describe each table by showing its name & listing the main fields in
it. Just the field names will do: you do not need their types &
lengths. Be sure to clearly show, which are the primary key field(s) of
each table.

HTH,
TC
 

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