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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grid - to insert new record

Status
Not open for further replies.

jhoann

Programmer
Apr 18, 2002
81
0
0
PH
hi,
is there someone who knows how to do this...
i'm working with sales monitoring system,
in my database i have sidb.mdb - table(sinvoice)-(access)
- sales invoice no.
-customer no.
-product code
-qty
-unit price
-total amount

i want in my screen like a master/detail , for example:

Sales no.: 00001
Customer no: 00001 (combo box)
customer name: will automatically filled up, after i chose the customer no.

below the screen is a datagrid, where i could insert a record:
prod code, prod name, qty , unit price
0001 Cloth 1 1000
0002 Pencil 2 500


can i have a sample code...
which one i'll use datagrid or msflexgrid....
please help and advice

Thanks ,
Jhoann



 
Why don't you try using the form data wizard?

menu: PROJECT|ADD FORM Then select the Data form wizard. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Function Adodc1Loading(DataSource_ As String, WorkersId_ As Integer, Year_ As String)
Dim SqlCommand, Shiit As String
Shiit = """"
SqlCommand = "SELECT QueryJanuary.Day, QueryJanuary.Start, " & _
"QueryJanuary.WEnd, QueryJanuary.Overtimestart, QueryJanuary.Overtimeend, QueryJanuary.Overtimetotal, " & _
"QueryJanuary.Holiday, QueryJanuary.Holidayfrom, QueryJanuary.Holidayto, QueryJanuary.Holidaytotal " & _
"FROM QueryJanuary WHERE QueryJanuary.January.WorkersId=" & WorkersId_ & " AND QueryJanuary.Year=" & Shiit & Year_ & Shiit
With Adodc1
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DataSource_ & ";" & _
"Persist Security Info=False"
.CommandType = adCmdText 'adCmdTable
.RecordSource = SqlCommand
.Refresh
End With

With DataGrid1
Set .DataSource = Adodc1
.Columns("Day").Width = 750
.Columns("Start").Width = 1400
.Columns("WEnd").Width = 1400
.Columns("Overtimestart").Width = 1400
.Columns("Overtimeend").Width = 1400
.Columns("Overtimetotal").Width = 1400
.Columns("Holiday").Width = 1400
.Columns("Holidayfrom").Width = 1400
.Columns("Holidayto").Width = 1400
.Columns("Holidaytotal").Width = 2400
.Refresh
End With
End Function

Use some text box or combobox to add your entry in your Table and then useing SQl command to find your specific data in your datagrid , like i did with my function , after adding new entry i just call my function to show matched criteria.

thank u
 
i'm sorry , i'm using
access 97 and dbgrid ...
how to do it - a adding new record in a form ...


again thanks
jhoann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top