rajamuzammil
New member
- Local time
 - Today, 07:40
 
- Joined
 - Jan 11, 2020
 
- Messages
 - 5
 
I have a form when it loads, it fetches a number and increments the last stored invoice number. 
UG added Code Tags
	
	
	
		
The table from which this is named as Fil03, based on WHSECID in that table i want this form to fetch number. How can i do this by changing something in the code given above. Your help will be highly appreciated.
 UG added Code Tags
		Code:
	
	
	Private Sub Form_Load()
  DoCmd.SetWarnings False
  DoCmd.OpenQuery "GRNDatatmpIni"
  Me.Refresh
 Me.Command42.Enabled = False
 Dim MyDb As Database
 Dim mFil03 As Recordset
 
 Set MyDb = DBEngine.Workspaces(0).Databases(0)
 Set mFil03 = MyDb.OpenRecordset("Fil03", dbOpenDynaset)
 If Not mFil03.BOF Then
  mFil03.MoveFirst
 End If
 mFil03.MoveNext
 
  If mFil03!CInvKey = "N" Then
   MsgBox "You can not make Invoice at this moment ..........", vbCritical
   DoCmd.Close
  End If
Me.InvNumber = mFil03!whdocno + 1
 
 
 mFil03.Edit
 mFil03!CInvKey = "N"
 mFil03.UPDATE
 mFil03.Close
 Me.Check52.Value = True
 Me.Check54.Value = False
 
Exit Sub
End Sub
	The table from which this is named as Fil03, based on WHSECID in that table i want this form to fetch number. How can i do this by changing something in the code given above. Your help will be highly appreciated.
			
				Last edited by a moderator: