Get posted records

  • Thread starter Thread starter Josh
  • Start date Start date
J

Josh

I have a purchase order form, when Items are received, they are 'posted';

Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblInventory", dbOpenDynaset)
rs.AddNew
rs!ItemID = Me.ItemID
rs!MfgrNumber = Me.StockNumber
rs!TransActionDate = Me.DateItemRec
rs!Quantity = Me.NumberReceived
..etc, rest of the fields
rs.Update
rs.Close
Set rs = Nothing
Set db = Nothing

What I would like to do, is to then have some message to the user, that:
Qty ItemID StockNumber etc have been posted to Inventory.

For example:
"34 Item56589, StockNo.7845, have been posted to Inventory."

I currently simply have a msgbox that, if there were no errors, displays that
"Records have been added". The problem with that, is that I'm not sure that I
would be aware of any errors, so I would like to display the last record
entered, (single user environment, so what they just posted would indeed be the
last record), to confirm that it was actually posted.

Any suggestions?
Thanks
 
What I would like to do, is to then have some message to the user, that:
Qty ItemID StockNumber etc have been posted to Inventory.

For example:
"34 Item56589, StockNo.7845, have been posted to Inventory."

I currently simply have a msgbox that, if there were no errors, displays that
"Records have been added". The problem with that, is that I'm not sure that I
would be aware of any errors, so I would like to display the last record
entered, (single user environment, so what they just posted would indeed be the
last record), to confirm that it was actually posted.

Ummmm...

rather than writing VBA code and popping up message boxes and such, why not
just use a WYSIWYG bound form? The user will be able to see the data directly
with no code at all!

You could certainly construct a text string with the values from the table,
but why go to all the extra effort to do something Access does for you for
free?

If you want though:

Dim strMsg As String
strMsg = "Item" & rs!ItemID & ", StockNo." & rs!StockNo & " have been..."
MsgBox strMsg, vbOKOnly

John W. Vinson [MVP]
 
Ummmm...

rather than writing VBA code and popping up message boxes and such, why not
just use a WYSIWYG bound form? The user will be able to see the data directly
with no code at all!

You could certainly construct a text string with the values from the table,
but why go to all the extra effort to do something Access does for you for
free?

If you want though:

Dim strMsg As String
strMsg = "Item" & rs!ItemID & ", StockNo." & rs!StockNo & " have been..."
MsgBox strMsg, vbOKOnly

John W. Vinson [MVP]

I was thinking of quering the DB, to make absolutely, totally certain that the
record(s) were actually added. However, as you say, simply providing a subform
showing the records (related by POLinteItemNumber) would be simple and probably
much better than the convoluted method I was trying to come up with.

Only problem is, there's not enough room on my PO Form! Time to reduce and
tighten up, I guess.

Thanks, that helps quite a bit.
 
Only problem is, there's not enough room on my PO Form! Time to reduce and
tighten up, I guess.

Consider using a Tab Control (from the form design toolbar). Put your PO form
controls on one page of the tab control, and your subform on the second page.
It's a way to share screen real estate and de-clutter your form.

John W. Vinson [MVP]
 
Back
Top