Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign Value ItemNumber

Status
Not open for further replies.

stricknine

Programmer
Jun 30, 2004
1
US
We have just recently purchased GP v 7.5 and no one in my department is familiar with the product. I have written VBA in the past and am pretty good at it. Now my question should be simple. On Card Inventory then on the item selection. The Item number field. We have built an auto-incrementing Identification number routine. The problem lies in that the only way that we can get that value into that field is by pulling it from the database via a recordset. If we try to put a literal or even variable string into the text field we seen nothing if it is coming from the record set then it's cool.

CODE:


cmd.CommandText = "SELECT MAX(ITEMNMBR)+1 FROM IV00101 WHERE ITEMNMBR < '99999999'"

Set rst = cmd.Execute

cmd.CommandText = "INSERT INTO IV00101 (ITEMNMBR, DECPLQTY, DECPLCUR) VALUES('" + CStr(rst(0)) + "', 1, 3)"

cmd.Execute

'set value in form...
'----------------------------------------
ItemNumber.Value = CStr(rst(0))

'ItemNumber.Value = "LiteralDoesNotWork"
'----------------------------------------
cn.Close

End Sub

Please let me know what I am doing wrong,

stricknine
 
A couple of questions.

1) are you using RetrieveGlobals.dll to open your ADO connection.

2) why do you have an Insert statement for auto-numbering

3) what is happening when you attempt to set the key field, is the field locked? What errors or warnings?

David Musgrave
Senior Development Consultant
MBS Services - Asia Pacific

Microsoft Business Solutions

mailto:dmusgrav@nospam-microsoft.com

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top