Drawing On Form In Code

Nov 10, 2011

The access import wizard has a convenient form when a fixed-width file is to be imported. The form allows us to click the data to insert an arrow at a position where the next field should begin.

For my project, the wizard has some serious shortcomings, so I am trying to build my own import form. I can capture everything else needed to build an import routine, but I can't figure out, nor find examples of, allowing the user to place column breaks graphically.how to do this without using the wizard? Or rather, like in the wizard?

View Replies


ADVERTISEMENT

Drawing Dots On An MS Form

Jun 30, 2005

im responding to the code you submitted to draw lines on a form. I am trying to change it a bit to only draw dots. I have x and y cordinates that I want to draw on the MS form kinda like a scatter graph. So I want to pass values from a table into the function LineX. Then have the function create dots that draw on the for to corespond to the x and y Cordinates. I was wondering if you could help.
thanks in advance


here is the original code
Option Compare Database
Option Explicit


Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, _
ByVal Y As Long) As Long

Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, _
ByVal Y As Long, lpPoint As Any) As Long

Private Declare Function apiGetDC Lib "user32" Alias "GetDC" _
(ByVal hWnd As Long) As Long

Private Declare Function apiGetFocus Lib "user32" _
Alias "GetFocus" _
() As Long

Public Function LineX(Ctrl As Control, X As Long, Y As Long, cx As Long, cy As Long)
Dim DC As Long
'device context
Dim hWndCtrl As Long
'bounding control handle
hWndCtrl = fhWnd(Ctrl)
'get control handle
DC = apiGetDC(hWndCtrl)
'get control DC
MoveToEx DC, X, Y, ByVal 0&
'set starting point
LineTo DC, cx, cy
'draw line from starting point to cx, cy
End Function

Private Function fhWnd(ctl As Control) As Long
'use getfocus to retrieve ctrl handle
On Error Resume Next
ctl.SetFocus
If Err Then
fhWnd = 0
Else
fhWnd = apiGetFocus
End If
On Error GoTo 0
End Function

View 1 Replies View Related

Drawing A Blank !

Aug 11, 2005

I have a table with three fields:
SSN
Member #
Case #
I want to create a form that I can search by SSN or Member # which will show all Case #'s known to the SSN or Member #.

A member can only have one SSN and one Member # but many Case #.

I've done this before, but can't remember how, can anyone help?

View 1 Replies View Related

Drawing Data From Multiple Tables

Mar 17, 2007

I am a new user to access and are therefore seeking the assistance of a more experienced user (I'm sure this will be an easy one for all out there).

I want to be able to get records from different tables after the table name has been chosen.

In other words and to be a bit more specific, at the moment in one table I am selecting the tables I want to get information from. Once I select the tables I need to then be able to extract the required data from the selected tables and then put it into a new table with summary totals.

View 8 Replies View Related

Random Number Generator For Customer Drawing.

Mar 9, 2006

My company does daily, weekly, and monthly drawings using mountains of entry tickets and a barrel that has seen better days. So needless to say this system has to go. I hope to be able to do it digitally.

I would like to do a random number generator to pick the winners based off of a ticket number range. The ticket numbers issued to the customer would correspond to the customer account number. To complicate things I would really love to have the random numbers displayed on the screen so people feel they are watching the randomization pick in progress with the winner name popping up.


I have searched Help for Rnd function, as well as googled. I haven had any luck finding what I need. Is what I am looking to do possible in access? I had something similar in Excel a few years ago but lost it.

View 7 Replies View Related

General :: Drawing A Line Over The Grid Depending On What Day It Is And Time

Sep 14, 2012

Here is a project. I have a grid on a form. its width is 20cm wide and 15cm tall. in the grid are 6 groups of columns (all columns listed are from left to right).

Group 1 - 5cm wide - description
Group 2 to 6 are 30cm wide and represent days. Each group is split into 8 columns which represent hours per working day.

I need to to draw or position a line over the grid depending on what day it is and time. for example, lets say its thursday at 14.30. ( the 8 hour columns run from 8am to 4pm ) it would need to look like this-

So I need to work out the position of of the line depending on the time of of the day in the week. The day can be determined by the column header, the time by the grid....

View 6 Replies View Related

Queries :: Drawing Register Database - Lookup Specific Criteria Based On Date

Aug 11, 2014

I have a drawing register database which notes the revisions for all drawings issued. One drawing can be revised several times so I have a details table which notes the revision letter, date issued and the notes for each revision. Using this table I created a max date query to show the latest issue date and revision for each drawing. This query is used for a transmittal form for issuing drawings. Both the form and report is working perfectly.

The TBLTransmittal consists of the following fields
ContractName
IssueDate
SubSup
DwgNo (multi-value checkbox)

Using the TBLDwgRegisterDtls or the query QRYDtldDwgReg (which includes the drawing titles) I would like to create a query that would look up the latest revision at the date of issue and show the revision letter.

I started a query combining TBLTransmittal and TBLDwgRegisterDtls and in the criteria for DateIssued of the TBLSDwgRegisterDtls (which is when the drawing was issued by the architect to the contractor) I put "Not > [IssueDate]". This is filtering the information to show revisions issued up to the date we (the contractor) issued the drawing to our sub-contractor but I need now to pull the max revision only from this information.

Before I go I will give you an example of what I want from the end result

Drawing BK2-02 rev. D was issued by the architect to the contractor on July 17th. This drawing was in-turn issued to our sub-contractor (Sub "A") this Saturday, August 9th. The same drawing was revised this morning and rev. E was issued to Sub "A" today, August 11th.

I want the end report to show that Sub A received Rev. D on 09-08-14 and Rev. E on 11-08-14.

I'm wondering if another max date query on this new query would work? I'll try and see what happens.

View 2 Replies View Related

Forms :: How To Use Data On A Form When Running Code Before Closing The Form

Feb 4, 2014

I have a bound form with a few fields. I would like to run a sub after some of these fields are modified, but not others. I would like it to run only once, after user finishes his work on the form.

When using the Unload event - the form on the form is not there anymore (or did I get something wrong?).

Is there a way to trap Data on form just before the form closes?

View 4 Replies View Related

Need Code To Open TeacherDetailFrm Form Main Form.

Jun 11, 2007

Hi
I need code to open TeacherDetailFrm form Main form.

I have TeacherStudentSubFr*m on the Mainform, FirstNameTxt on the TeacherStudentSubFr*m, and TeacherDetailFrm.
I need code to open the TeacherDetailFrm By double click on the FirstNameTxt.

I use this code but no data come and query dialog box come.

Private Sub FirstNameTxt_DblCli*ck(Cancel As Integer)
Dim DocSubForm As String
Dim DocText As String
DocSubForm = "TeacherDetailFrm"
'DocText = "[Result]=" & "'" & Me![result] & "'"
DoCmd.OpenForm DocSubForm, , , "[ FirstNameFld ]=forms![TeacherStudentSubFrm]![ FirstNameTxt]"

End Sub


I like to upload the file but no way in this forum

View 2 Replies View Related

Search Code Work On One Form But Not The Other Form?

Jul 18, 2015

* This code works to search frmMember for criteria found in tblMember:

Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
MsgBox "You must enter a search string."

[Code] ....

* But this next code which I have copied and Pasted to frmEventInput, then renamed the frm and tbl, retrieves the same criteria as the above (tblMember) instead of the tblEventInfo...

Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
MsgBox "You must enter a search string."

[code]...

What am I missing?

View 3 Replies View Related

Form With VB Code

May 10, 2005

hey can anyone please explain how to adjust the below code to open the specific order ID that has been double clicked? At the moment no matter which order is double clicked the same order is opened.

Private Sub OrderID_DblClick(Cancel As Integer)
On Error GoTo Err_OrderID_DblClick

Dim stDocName As String
stDocName = "Orders"
DoCmd.OpenForm stDocName



Exit_OrderID_DblClick:
Exit Sub

Err_OrderID_DblClick:
MsgBox Err.Description
Resume Exit_OrderID_DblClick


End Sub

Thanks in advance.

View 7 Replies View Related

Need Help With Code Behind Form

Feb 20, 2006

I have a db that has only 1 table and 1 form (picker db). That is because we only use it to gather info from pickers and dont want them to be able to do anything but enter data. I have a master db that is used by Managers to import data from pickers db to master db to run reports.

Problem is we have someone that is an Access wannabe and sometimes messes with the code behind the form. The only way they can get behind the form is F11 key. I am afraid that if I take off that option then I cant get into the form myself...

Is there some other way that I can set this up in startup and have a way to get into the design view if I need to?

You can tell that I am a new user :)
Thanks, Noreene

View 2 Replies View Related

VBA Code For A Form

Jan 5, 2006

on a form, i want to edit some vba code

how do i type vba code to add days to todays date

for example, if the [company name] field on the form is one thing, then the vba code should calculate 14 days after todays date, and output it in the [return date] field on the form
but if the [company name] field is somthing else, the vba code should calculate 30 days after todays date and output it on the [return date] field

here is my code right now

Private Sub Return_Date BeforeUpdate(Cancel As Integer)

Select Case Form![Company Name]
Case "CTI/Charlotte", "CTI/Chicago"
Form![return date] = DateAdd("d", 14, [return date])
Case Else
Form![return date] = DateAdd("d", 30, [return date])
End Select
End Sub

im sure this is easy to do, but im new to vba. i have to be able to do this in vba.

View 6 Replies View Related

Code For Rename Form

May 24, 2005

On the form On load event I have code verifying if a condition is true or not. If the condition is true, it does some things, now I want also to rename a form if the condition is true. So, I have created a macro to do this. But if I open the DB for second, third.... time and the condition is still true the macro can't find the specifyed form and brings up an error message wich gives to user the possibility to Debug. This way he has access to the code , and I don't want this to hapen.
Can I do this by using code and keeping the user away from code?
Thanks,
Attila

View 2 Replies View Related

Post-code On Form

Jan 23, 2008

Hallo,

I have a post code field on my form. What I want to do is, if a user enters a wrong code ... i,.e., not Post code format it alerts the user of post-code not in use. Please if there is any example of a database of this functionality usage or a way of doing it will be much appreciated.

I live in UK and the post codes down here are like E12 5AH ....

Many thanks

View 1 Replies View Related

Code Snippet On Form...help Me

Feb 22, 2005

hai

Im novice to access db, started couple of days before on urgent requirement .
the functionality part is , i need to create a form to interact with databse and get the necessary output .

Dim dbsExample As Database
Dim rstExample As Recordset
Dim fldExample As Field
Dim str As String
//
Private Sub Command4_Click()
Set dbsExample = OpenDatabase("db1.mdb")
str = "type_ur_id.Text"
rstExample = dbsExample.OpenRecordset("select * from xxx where ID=str")
If (!rstExample.EOF) Then
Text0.Text = rstExample(1)
Recordset.Close
End If
End Sub
//
on running this form , error is INVALID USE OF PROPERTY >

rstExample(1) retreives the ID column value. .

could anyof u suggest where the problem could be,,and give me an alternate code..

with regards
rhuy.

View 3 Replies View Related

Form Code Not Working

Aug 1, 2005

Maybe this should be posted under VBA.... not sure. Havent seen answer that works yet.
Its a form with an option group "PickWO" When you pick an option, different fieilds become visible-non visible. I created a field "PickWOvalue" to store the option value "1" or "2". That part works fine.(visible) The problem is when you reopen the form to view the records the option box value does not show or change the fields visible properties. And the on open cuauses an error. Anyone see the problem?




Private Sub Form_Open(Cancel As Integer)
Me.PickWOvalue.Value = Me.PickWO.Value
End Sub
`````````````````````````````````````
Private Sub PickWO_AfterUpdate()

Call NotVisible

Select Case Me.PickWO

Case Is = 1
Me.ReInspectionDate.Visible = True
Me.Price.Visible = False
Me.WOPreview.Visible = True
Me.PrtWO.Visible = True
Me.WBMInvoice_.Visible = False

Case Is = 2
Me.ReInspectionDate.Visible = False
Me.Price.Visible = True
Me.cmdPreTag.Visible = True
Me.cmdPrtTag.Visible = True
Me.WBMInvoice_.Visible = True


End Select

End Sub

View 6 Replies View Related

VB Code Help On An Access Form....

May 10, 2006

I've got 2 sub forms that I intend on using via a toggle button from my primary form to access them. Is there anyone that can give me a heads up on creating vb code that when OnOpen it will automatically advance to a new record for data entry? I want the form to keep anyone from accidentally changing existing info in that regard. I'm still really new with VB.

Thanks for any help,

Trey

View 1 Replies View Related

Code On Current On A Form

Jun 27, 2006

i have a subform within a form that i want to create and automated procedure.
the subform has a couple of combo boxes.

upon input into the subform i want to do something like if the value of combobox1 starts out with the letter B then the value of combobox3 equals combobox2 * 1/2
i am just having a hard time putting it in code.

as of now i have a on current event on the subform that reads

if me.[combobox1] like "b*" then
me.[combobox3] = me.[combobox2]*.05
end if

any help would be greatly appreciated!

View 1 Replies View Related

Code On Current On A Form

Jun 27, 2006

i have a subform within a form that i want to create and automated procedure.
the subform has a couple of combo boxes.

upon input into the subform i want to do something like if the value of combobox1 starts out with the letter B then the value of combobox3 equals combobox2 * 1/2
i am just having a hard time putting it in code.

as of now i have a on current event on the subform that reads

if me.[combobox1] like "b*" then
me.[combobox3] = me.[combobox2]*.05
end if

any help would be greatly appreciated!

View 1 Replies View Related

Code On Current On A Form

Jun 27, 2006

i have a subform within a form that i want to create and automated procedure.
the subform has a couple of combo boxes.

upon input into the subform i want to do something like if the value of combobox1 starts out with the letter B then the value of combobox3 equals combobox2 * 1/2
i am just having a hard time putting it in code.

as of now i have a on current event on the subform that reads

if me.[combobox1] like "b*" then
me.[combobox3] = me.[combobox2]*.05
end if

any help would be greatly appreciated!

View 1 Replies View Related

Urgent Help With Form Code Please

Sep 12, 2004

ok what follows is a kind of pseudocode of what I'm trying to do. It would really help if someone could tell me how to get a command button to do the following startin by the copying of fields into a new record in a table and then using that table to do the required actions. Any help would be greatly appreciated and yes it is urgent as the assignment is due in on Wednesday.

Copy fields into new record in table Transactions
If [Transaction.In or Out] = In Then

[Items.Current Qty] (for specified Part No.) = [Items.Current Qty] + [Transaction.Qty]

(Add new record to Purchase Orders Table)

[Purchase Orders.Purchase Order No] = [Transaction.From/To]

[Purchase Orders.Part No] = [Transaction.Part No]

End If

If [Transaction.In or Out] = Out Then

[Items.Current Qty] = [Items.Current Qty] – [Transaction.Qty]

(Add new record to Sales Orders)

[Sales Orders.Part No] = [Transaction.Part No.]

[Sales Orders.Sales Order No.] = [Transaction.From/To]

End If

View 1 Replies View Related

Bad Code In Form Filter

Mar 15, 2005

I found some code that lets me Filter a Report from a Popup Form. It uses 6 combo boxes with each box filtering my VehicleRecords table to the record I am looking for. The code for this can be found here: http://support.microsoft.com/kb/q208529
I modified just a few lines so that it would point to my VehicleRecords table.

When I enter information into any one of the combo boxes I get a Run Time Error 13 - Type Mismatch, and then I am pointed to this section of code.

What is wrong with this code?

Code: strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " _& " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & "" _ And ""

View 3 Replies View Related

VB Code To Load A Form

Mar 14, 2006

Hi Guys

How do I load a form from another form? I would prefer to use VB (in fact, its probably the only way you can do it!). I have tried varius commands that would have worked in VB - but dont work in Access, like...

Code:Unload MeLoad Form_tblClientsForm_tblClients.show

The above code does not work AT ALL. It gets an error at the Unload Me line, an error at the Load Form_tblClients line, and the action 'Show' does not even exist under Form_tblClients, so that wont work either!

I am aware of Switchborads, but i want to know how to load a form, and make it pop up in a new window from within another form.

View 3 Replies View Related

Code Refeerencing From One Form To Another

Apr 4, 2006

The scenario: I have a command button on one form (cmdPatinient on frmData) . This command button opens a form (frmAssessment).
On this form I have a check box option (yes/no). (chkAnswer) If the checkbox is ticked (to indicate data entry is complete) then I want the command button on the other form to be disabled.


So, do I put the code on the On Click event of the form with the checkbox and then how do I reference the other form?

View 1 Replies View Related

Help In Access Form Code

Apr 5, 2007

Hi,

I have a form in access database. On click of a button I want to perform update process for records in a table "abc" in the same database. I have written the following code in the onclick function,

Code: Dim rs As New ADODB.Recordset Dim rsCount As New ADODB.Recordset Dim CntVal As Integer Dim con As New ADODB.Connection con.Provider = "microsoft.jet.oledb.4.0" con.Mode = adModeShareExclusive con.Open ("C: est.mdb") rs.Open "Select * from abc" Do While Not rs.EOF rsCount.Open "select count(test) from abc where test = '" & rs.Fields("test") & "'" If Not rsCount.EOF Then CntVal = rsCount.Fields(0).Value Else CntVal = 0 End If rsCount.Close con.Execute "Update abc set testcount = '" & CntVal & "' where ID1 = '" & rs.Fields("ID1").value & "'" Loop

In the above code, I am not able to use the command,
con.Open (App.Path & " est.mdb"). It gives "Object Required Error". And while opening the con object I get the error "You attempted to open a database that is already opened exclusively by user 'Admin' on machine ''. Try again when the database is available."

Kindly advise how to solve this problem.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved